diff --git a/README.md b/README.md index 0f0ec43..f73247f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo ## Language packs +- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax) - [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin, ftdetect) - [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect) - [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin, ftdetect) diff --git a/build b/build index ebcdb09..4a3faaa 100755 --- a/build +++ b/build @@ -99,6 +99,7 @@ EOF } PACKS=" + applescript:vim-scripts/applescript.vim ansible:pearofducks/ansible-vim arduino:sudar/vim-arduino-syntax blade:jwalton512/vim-blade diff --git a/extras/flow.vim b/extras/flow.vim index 6ce7ed9..d082d4e 100644 --- a/extras/flow.vim +++ b/extras/flow.vim @@ -90,3 +90,141 @@ if version >= 508 || !exists("did_javascript_syn_inits") endif endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject +syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass +syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock +syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend +syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend +syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue +syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster +syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster +syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster +syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster +syntax keyword jsFlowDeclareKeyword contained declare +syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array +syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow +syntax match jsFlowNoise contained /[:;,<>]/ +syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow +syntax keyword jsFlowStorageClass contained const var let +syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue +syntax region jsFlowClass contained matchgroup=jsFlowNoise start=// oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock + +if version >= 508 || !exists("did_javascript_syn_inits") + if version < 508 + let did_javascript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsFlow PreProc + HiLink jsFlowReturn PreProc + HiLink jsFlowArray PreProc + HiLink jsFlowDeclareBlock PreProc + HiLink jsFlowObject PreProc + HiLink jsFlowParenRegion PreProc + HiLink jsFlowClass PreProc + HiLink jsFlowTypeObject PreProc + HiLink jsFlowTypeKey PreProc + HiLink jsFlowTypeValue PreProc + HiLink jsFlowClassProperty jsClassProperty + HiLink jsFlowType Type + HiLink jsFlowDeclareKeyword Type + HiLink jsFlowNoise Noise + delcommand HiLink +endif + +endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject +syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass +syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock +syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend +syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend +syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue +syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster +syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster +syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster +syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster +syntax keyword jsFlowDeclareKeyword contained declare +syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array +syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow +syntax match jsFlowNoise contained /[:;,<>]/ +syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow +syntax keyword jsFlowStorageClass contained const var let +syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue +syntax region jsFlowClass contained matchgroup=jsFlowNoise start=// oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock + +if version >= 508 || !exists("did_javascript_syn_inits") + if version < 508 + let did_javascript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsFlow PreProc + HiLink jsFlowReturn PreProc + HiLink jsFlowArray PreProc + HiLink jsFlowDeclareBlock PreProc + HiLink jsFlowObject PreProc + HiLink jsFlowParenRegion PreProc + HiLink jsFlowClass PreProc + HiLink jsFlowTypeObject PreProc + HiLink jsFlowTypeKey PreProc + HiLink jsFlowTypeValue PreProc + HiLink jsFlowClassProperty jsClassProperty + HiLink jsFlowType Type + HiLink jsFlowDeclareKeyword Type + HiLink jsFlowNoise Noise + delcommand HiLink +endif + +endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject +syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass +syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock +syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend +syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend +syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue +syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster +syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster +syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster +syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster +syntax keyword jsFlowDeclareKeyword contained declare +syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array +syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow +syntax match jsFlowNoise contained /[:;,<>]/ +syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow +syntax keyword jsFlowStorageClass contained const var let +syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue +syntax region jsFlowClass contained matchgroup=jsFlowNoise start=// oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock + +if version >= 508 || !exists("did_javascript_syn_inits") + if version < 508 + let did_javascript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsFlow PreProc + HiLink jsFlowReturn PreProc + HiLink jsFlowArray PreProc + HiLink jsFlowDeclareBlock PreProc + HiLink jsFlowObject PreProc + HiLink jsFlowParenRegion PreProc + HiLink jsFlowClass PreProc + HiLink jsFlowTypeObject PreProc + HiLink jsFlowTypeKey PreProc + HiLink jsFlowTypeValue PreProc + HiLink jsFlowClassProperty jsClassProperty + HiLink jsFlowType Type + HiLink jsFlowDeclareKeyword Type + HiLink jsFlowNoise Noise + delcommand HiLink +endif + +endif diff --git a/extras/jsdoc.vim b/extras/jsdoc.vim index 7ce5f62..94e4951 100644 --- a/extras/jsdoc.vim +++ b/extras/jsdoc.vim @@ -84,3 +84,132 @@ if version >= 508 || !exists("did_javascript_syn_inits") endif endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +"" syntax coloring for javadoc comments (HTML) +syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold + +" tags containing a param +syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam +" tags containing type and param +syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType +" tags containing type but no param +syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam +" tags containing references +syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag +" other tags (no extra syntax) +syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>" + +syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam +syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam +syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend +syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend +syntax region jsDocTypeNoParam contained start="{" end="}" oneline +syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" +syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+" +syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags + +if version >= 508 || !exists("did_javascript_syn_inits") + if version < 508 + let did_javascript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsDocTags Special + HiLink jsDocSeeTag Function + HiLink jsDocType Type + HiLink jsDocTypeBrackets jsDocType + HiLink jsDocTypeRecord jsDocType + HiLink jsDocTypeNoParam Type + HiLink jsDocParam Label + delcommand HiLink +endif + +endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +"" syntax coloring for javadoc comments (HTML) +syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold + +" tags containing a param +syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam +" tags containing type and param +syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType +" tags containing type but no param +syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam +" tags containing references +syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag +" other tags (no extra syntax) +syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>" + +syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam +syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam +syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend +syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend +syntax region jsDocTypeNoParam contained start="{" end="}" oneline +syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" +syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+" +syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags + +if version >= 508 || !exists("did_javascript_syn_inits") + if version < 508 + let did_javascript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsDocTags Special + HiLink jsDocSeeTag Function + HiLink jsDocType Type + HiLink jsDocTypeBrackets jsDocType + HiLink jsDocTypeRecord jsDocType + HiLink jsDocTypeNoParam Type + HiLink jsDocParam Label + delcommand HiLink +endif + +endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +"" syntax coloring for javadoc comments (HTML) +syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold + +" tags containing a param +syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam +" tags containing type and param +syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType +" tags containing type but no param +syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam +" tags containing references +syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag +" other tags (no extra syntax) +syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>" + +syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam +syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam +syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend +syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend +syntax region jsDocTypeNoParam contained start="{" end="}" oneline +syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" +syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+" +syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags + +if version >= 508 || !exists("did_javascript_syn_inits") + if version < 508 + let did_javascript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsDocTags Special + HiLink jsDocSeeTag Function + HiLink jsDocType Type + HiLink jsDocTypeBrackets jsDocType + HiLink jsDocTypeRecord jsDocType + HiLink jsDocTypeNoParam Type + HiLink jsDocParam Label + delcommand HiLink +endif + +endif diff --git a/extras/ngdoc.vim b/extras/ngdoc.vim index 7065cb8..0fd5587 100644 --- a/extras/ngdoc.vim +++ b/extras/ngdoc.vim @@ -12,3 +12,24 @@ syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" n syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+" endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite +syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite +syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+" + +endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite +syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite +syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+" + +endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + +syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite +syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite +syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+" + +endif diff --git a/syntax/applescript.vim b/syntax/applescript.vim new file mode 100644 index 0000000..d22b11b --- /dev/null +++ b/syntax/applescript.vim @@ -0,0 +1,249 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'applescript') == -1 + +" Vim syntax file +" Language: AppleScript +" Maintainer: Jim Eberle +" Last Change: Mar 18, 2010 +" URL: http://www.fastnlight.com/syntax/applescript.vim + +" Use :syn w/in a buffer to see language element breakdown + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" --- Statement --- +syn keyword scptStmt get set count copy run global local prop property +syn keyword scptStmt close put delete duplicate exists +syn keyword scptStmt launch open print quit make move reopen save +syn keyword scptStmt saving into +hi def link scptStmt Statement + +" --- Type --- +syn keyword scptType text string number integer real color date +hi def link scptType Type + +" --- Operator --- +syn keyword scptOp div mod not and or as +syn match scptOp "[-+*/^&]" +" MacRoman single char :- (divide) +exec 'syn match scptOp "'.nr2char(214).'"' +syn match scptOp "\<\(a \)\?\(ref\( to\)\?\|reference to\)\>" +hi def link scptOp Operator + +" Containment +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +syn match scptIN "\" +hi def link scptIN scptOp + +" Equals +syn match scptEQ "=" +syn match scptEQ "\" +syn match scptEQ "\" +syn match scptEQ "\" +syn match scptEQ "\" +syn match scptEQ "\" +hi def link scptEQ scptOp + +" Not Equals +syn match scptNE "\" +syn match scptNE "\" +syn match scptNE "\" +syn match scptNE "\" +syn match scptNE "\" +syn match scptNE "\" +hi def link scptNE scptOp +" MacRoman single char /= +exec 'syn match scptNE "'.nr2char(173).'"' + +" Less Than +syn match scptLT "<" +syn match scptLT "\" +syn match scptLT "\(is \)\?less than" +syn match scptLT "\" +syn match scptLT "\" +hi def link scptLT scptOp + +" Greater Than +syn match scptGT ">" +syn match scptGT "\" +syn match scptGT "\(is \)\?greater than" +syn match scptGT "\" +syn match scptGT "\" +hi def link scptGT scptOp + +" Less Than or Equals +syn match scptLE "<=" +syn match scptLE "\" +syn match scptLE "\" +syn match scptLE "\(is \)\?less than or equal\( to\)\?" +syn match scptLE "\" +syn match scptLE "\" +hi def link scptLE scptOp +" MacRoman single char <= +exec 'syn match scptLE "'.nr2char(178).'"' + +" Greater Than or Equals +syn match scptGE ">=" +syn match scptGE "\" +syn match scptGE "\" +syn match scptGE "\(is \)\?greater than or equal\( to\)\?" +syn match scptGE "\" +syn match scptGE "\" +hi def link scptGE scptOp +" MacRoman single char >= +exec 'syn match scptGE "'.nr2char(179).'"' + +" --- Constant String --- +syn region scptString start=+"+ skip=+\\\\\|\\"+ end=+"+ +hi def link scptString String + +" --- Constant Number --- +syn match scptNumber "\<-\?\d\+\>" +hi def link scptNumber Number + +" --- Constant Float --- +syn match scptFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=" +syn match scptFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=\>" +syn match scptFloat display contained "\d\+e[-+]\>" +hi def link scptFloat Float + +" --- Constant Boolean --- +syn keyword scptBoolean true false yes no ask +hi def link scptBoolean Boolean + +" --- Other Constants --- +syn keyword scptConst it me version pi result space tab anything +syn match scptConst "\" + +" Considering and Ignoring +syn match scptConst "\" +syn match scptConst "\" +syn match scptConst "\" +syn keyword scptConst case diacriticals expansion hyphens punctuation +hi def link scptConst Constant + +" Style +syn match scptStyle "\" +syn match scptStyle "\" +syn match scptStyle "\" +syn keyword scptStyle bold condensed expanded hidden italic outline plain +syn keyword scptStyle shadow strikethrough subscript superscript underline +hi def link scptStyle scptConst + +" Day +syn keyword scptDay Mon Tue Wed Thu Fri Sat Sun +syn keyword scptDay Monday Tuesday Wednesday Thursday Friday Saturday Sunday +syn keyword scptDay weekday +hi def link scptDay scptConst + +" Month +syn keyword scptMonth Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec +syn keyword scptMonth January February March +syn keyword scptMonth April May June +syn keyword scptMonth July August September +syn keyword scptMonth October November December +syn keyword scptMonth month +hi def link scptMonth scptConst + +" Time +syn keyword scptTime minutes hours days weeks +hi def link scptTime scptConstant + +" --- Conditional --- +syn keyword scptCond if then else +syn match scptCond "\" +hi def link scptCond Conditional + +" --- Repeat --- +syn keyword scptRepeat repeat with from to by continue +syn match scptRepeat "\" +syn match scptRepeat "\" +syn match scptRepeat "\" +syn match scptRepeat "\" +hi def link scptRepeat Repeat + +" --- Exception --- +syn keyword scptException try error +syn match scptException "\" +syn match scptException "\" +syn match scptException "\" +hi def link scptException Exception + +" --- Keyword --- +syn keyword scptKeyword end tell times exit +syn keyword scptKeyword application file alias activate +syn keyword scptKeyword script on return without given +syn keyword scptKeyword considering ignoring items delimiters +syn keyword scptKeyword some each every whose where id index item its +syn keyword scptKeyword first second third fourth fifth sixth seventh +syn keyword scptKeyword eighth ninth tenth container +syn match scptKeyword "\d\+\(st\|nd\|rd\|th\)" +syn keyword scptKeyword last front back middle named thru through +syn keyword scptKeyword before after in of the +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "\" +syn match scptKeyword "'s" +hi def link scptKeyword Keyword + +" US Units +syn keyword scptUnitUS quarts gallons ounces pounds inches feet yards miles +syn match scptUnitUS "\" +syn match scptUnitUS "\" +syn match scptUnitUS "\" +syn match scptUnitUS "\" +syn match scptUnitUS "\" +syn match scptUnitUS "\" +syn match scptUnitUS "\" +hi def link scptUnitUS scptKey + +" British Units +syn keyword scptUnitBT litres centimetres metres kilometres +syn match scptUnitBT "\" +syn match scptUnitBT "\" +syn match scptUnitBT "\" +syn match scptUnitBT "\" +hi def link scptUnitBT scptKey + +" Metric Units +syn keyword scptUnitMT liters centimeters meters kilometers grams kilograms +syn match scptUnitMT "\" +syn match scptUnitMT "\" +syn match scptUnitMT "\" +syn match scptUnitMT "\" +syn match scptUnitMT "\" +syn match scptUnitMT "\" +hi def link scptUnitMT scptKey + +" --- Comment --- +syn match scptComment "--.*" +syn match scptComment "#.*" +syn region scptComment start="(\*" end="\*)" +hi def link scptComment Comment + +" --- Todo --- +syn keyword scptTodo contained TODO FIXME XXX +hi def link scptTodo Todo + +let b:current_syntax = "applescript" + + +endif