From 3019afa721b893ebfe130eb4f955bc4c0c20ec23 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 26 Jul 2016 14:08:59 +0200 Subject: Add applescript, closes #133 --- syntax/applescript.vim | 249 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 syntax/applescript.vim (limited to 'syntax/applescript.vim') diff --git a/syntax/applescript.vim b/syntax/applescript.vim new file mode 100644 index 00000000..d22b11b7 --- /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 -- cgit v1.2.3