codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: Asymptote3" Maintainer: Avid Seeker <avidseeker7@protonmail.com>4" Andy Hammerlindl5" Last Change: 2022 Jan 056" 2025 Apr 16 by Vim Project (set 'cpoptions' for line continuation, #17121)7 8" Hacked together from Bram Moolenaar's C syntax file, and Claudio Fleiner's9" Java syntax file.10 11if exists("b:current_syntax")12 finish13endif14 15let s:cpo_save = &cpo16set cpo&vim17 18" useful C/C++/Java keywords19syn keyword asyStatement break return continue unravel20syn keyword asyConditional if else21syn keyword asyRepeat while for do22syn keyword asyExternal access from import include23syn keyword asyOperator new operator24 25" basic asymptote keywords26syn keyword asyConstant VERSION27syn keyword asyConstant true false default infinity inf nan28syn keyword asyConstant null nullframe nullpath nullpen29syn keyword asyConstant intMin intMax realMin realMax30syn keyword asyConstant realEpsilon realDigits31syn keyword asyPathSpec and cycle controls tension atleast curl32syn keyword asyStorageClass static public restricted private explicit33syn keyword asyStructure struct typedef34syn keyword asyType void bool bool3 int real string file35syn keyword asyType pair triple transform guide path pen frame36syn keyword asyType picture37 38" module specific keywords39if exists("asy_syn_plain")40 syn keyword asyConstant currentpicture currentpen defaultpen41 syn keyword asyConstant inch inches cm mm bp pt up down right left42 syn keyword asyConstant E NE N NW W SW S SE43 syn keyword asyConstant ENE NNE NNW WNW WSW SSW SSE ESE44 syn keyword asyConstant I pi twopi45 syn keyword asyConstant CCW CW46 syn keyword asyConstant undefined sqrtEpsilon Align mantissaBits47 syn keyword asyConstant identity zeroTransform invert48 syn keyword asyConstant stdin stdout49 syn keyword asyConstant unitsquare unitcircle circleprecision50 syn keyword asyConstant solid dotted Dotted dashed dashdotted51 syn keyword asyConstant longdashed longdashdotted52 syn keyword asyConstant squarecap roundcap extendcap53 syn keyword asyConstant miterjoin roundjoin beveljoin54 syn keyword asyConstant zerowinding evenodd basealign nobasealign55 syn keyword asyConstant black white gray red green blue Cyan Magenta56 syn keyword asyConstant Yellow Black cyan magenta yellow palered57 syn keyword asyConstant palegreen paleblue palecyan palemagenta58 syn keyword asyConstant paleyellow palegray lightred lightgreen59 syn keyword asyConstant lightblue lightcyan lightmagenta lightyellow60 syn keyword asyConstant lightgray mediumred mediumgreen mediumblue61 syn keyword asyConstant mediumcyan mediummagenta mediumyellow62 syn keyword asyConstant mediumgray heavyred heavygreen heavyblue63 syn keyword asyConstant heavycyan heavymagenta lightolive heavygray64 syn keyword asyConstant deepred deepgreen deepblue deepcyan65 syn keyword asyConstant deepmagenta deepyellow deepgray darkred66 syn keyword asyConstant darkgreen darkblue darkcyan darkmagenta67 syn keyword asyConstant darkolive darkgray orange fuchsia chartreuse68 syn keyword asyConstant springgreen purple royalblue salmon brown69 syn keyword asyConstant olive darkbrown pink palegrey lightgrey70 syn keyword asyConstant mediumgrey grey heavygrey deepgrey darkgrey71 72 if exists("asy_syn_texcolors")73 syn keyword asyConstant GreenYellow Yellow Goldenrod Dandelion74 syn keyword asyConstant Apricot Peach Melon YellowOrange Orange75 syn keyword asyConstant BurntOrange Bittersweet RedOrange Mahogany76 syn keyword asyConstant Maroon BrickRed Red OrangeRed RubineRed77 syn keyword asyConstant WildStrawberry Salmon CarnationPink Magenta78 syn keyword asyConstant VioletRed Rhodamine Mulberry RedViolet79 syn keyword asyConstant Fuchsia Lavender Thistle Orchid DarkOrchid80 syn keyword asyConstant Purple Plum Violet RoyalPurple BlueViolet81 syn keyword asyConstant Periwinkle CadetBlue CornflowerBlue82 syn keyword asyConstant MidnightBlue NavyBlue RoyalBlue Blue83 syn keyword asyConstant Cerulean Cyan ProcessBlue SkyBlue Turquoise84 syn keyword asyConstant TealBlue Aquamarine BlueGreen Emerald85 syn keyword asyConstant JungleGreen SeaGreen Green ForestGreen86 syn keyword asyConstant PineGreen LimeGreen YellowGreen SpringGreen87 syn keyword asyConstant OliveGreen RawSienna Sepia Brown Tan Gray88 syn keyword asyConstant Black White89 endif90 91 if exists("asy_syn_x11colors")92 syn keyword asyConstant AliceBlue AntiqueWhite Aqua Aquamarine Azure93 syn keyword asyConstant Beige Bisque Black BlanchedAlmond Blue94 syn keyword asyConstant BlueViolet Brown BurlyWood CadetBlue95 syn keyword asyConstant Chartreuse Chocolate Coral CornflowerBlue96 syn keyword asyConstant Cornsilk Crimson Cyan DarkBlue DarkCyan97 syn keyword asyConstant DarkGoldenrod DarkGray DarkGreen DarkKhaki98 syn keyword asyConstant DarkMagenta DarkOliveGreen DarkOrange99 syn keyword asyConstant DarkOrchid DarkRed DarkSalmon DarkSeaGreen100 syn keyword asyConstant DarkSlateBlue DarkSlateGray DarkTurquoise101 syn keyword asyConstant DarkViolet DeepPink DeepSkyBlue DimGray102 syn keyword asyConstant DodgerBlue FireBrick FloralWhite ForestGreen103 syn keyword asyConstant Fuchsia Gainsboro GhostWhite Gold Goldenrod104 syn keyword asyConstant Gray Green GreenYellow Honeydew HotPink105 syn keyword asyConstant IndianRed Indigo Ivory Khaki Lavender106 syn keyword asyConstant LavenderBlush LawnGreen LemonChiffon107 syn keyword asyConstant LightBlue LightCoral LightCyan108 syn keyword asyConstant LightGoldenrodYellow LightGreen LightGrey109 syn keyword asyConstant LightPink LightSalmon LightSeaGreen110 syn keyword asyConstant LightSkyBlue LightSlateGray LightSteelBlue111 syn keyword asyConstant LightYellow Lime LimeGreen Linen Magenta112 syn keyword asyConstant Maroon MediumAquamarine MediumBlue113 syn keyword asyConstant MediumOrchid MediumPurple MediumSeaGreen114 syn keyword asyConstant MediumSlateBlue MediumSpringGreen115 syn keyword asyConstant MediumTurquoise MediumVioletRed MidnightBlue116 syn keyword asyConstant MintCream MistyRose Moccasin NavajoWhite117 syn keyword asyConstant Navy OldLace Olive OliveDrab Orange118 syn keyword asyConstant OrangeRed Orchid PaleGoldenrod PaleGreen119 syn keyword asyConstant PaleTurquoise PaleVioletRed PapayaWhip120 syn keyword asyConstant PeachPuff Peru Pink Plum PowderBlue Purple121 syn keyword asyConstant Red RosyBrown RoyalBlue SaddleBrown Salmon122 syn keyword asyConstant SandyBrown SeaGreen Seashell Sienna Silver123 syn keyword asyConstant SkyBlue SlateBlue SlateGray Snow SpringGreen124 syn keyword asyConstant SteelBlue Tan Teal Thistle Tomato Turquoise125 syn keyword asyConstant Violet Wheat White WhiteSmoke Yellow126 syn keyword asyConstant YellowGreen127 endif128 129 if exists("asy_syn_three")130 syn keyword asyType path3 guide3 transform3131 syn keyword asyType projection light material patch surface tube132 syn keyword asyConstant currentprojection currentlight defaultrender133 syn keyword asyConstant identity4 O X Y Z134 syn keyword asyConstant nolight nullpens135 syn keyword asyConstant unitsphere unithemisphere unitplane octant1136 syn keyword asyConstant unitcone unitsolidcone unitcube unitcylinder137 syn keyword asyConstant unitdisk unittube138 endif139endif140 141 142" string constants143syn region asyCString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=asyCSpecial144syn match asyCSpecial display contained +\\\(['"?\\abfnrtv]\|\o\{1,3}\)+145syn match asyCSpecial display contained +\\\(x[0-9A-F]\{1,2\}\|$\)+146" double quoted strings only special character is \"147syn region asyString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=asySpecial148syn match asySpecial display contained +\(\\\)\@1<!\(\\\\\)*\zs\\"+149 150 151" number constants152syn match asyNumbers display transparent "\<\d\|\.\d"153 \ contains=asyNumber,asyNumberError154syn match asyNumber display contained "\d*\.\=\d*\(e[-+]\=\d\+\)\="155" highlight number constants with two '.' or with '.' after an 'e'156syn match asyNumberError display contained "\d*\.\(\d\|e[-+]\=\)*\.[0-9.]*"157syn match asyNumberError display contained "\d*e[-+]\=\d*\.[0-9.]*"158syn match asyNumberError display contained "\d*e[-+]\=\(e[-+]\=\)*\.[0-9.]*"159 160 161" comments and comment strings162syn keyword asyTodo contained TODO FIXME XXX163syn sync ccomment asyComment minlines=15164if exists("asy_comment_strings")165 " A comment can contain asyString, asyCString, and asyNumber. But a "*/"166 " inside a asy*String in a asyComment DOES end the comment! So we need to167 " use a special type of asy*String: asyComment*String, which also ends on168 " "*/", and sees a "*" at the start of the line as comment again.169 " Unfortunately this doesn't very well work for // type of comments :-(170 syn match asyCommentSkip contained "^\s*\*\($\|\s\+\)"171 syn region asyCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+172 \ end=+\*/+me=s-1173 \ contains=asySpecial,asyCommentSkip174 syn region asyCommentCString contained start=+'+ skip=+\\\\\|\\'+ end=+'+175 \ end=+\*/+me=s-1176 \ contains=asyCSpecial,asyCommentSkip177 syn region asyCommentLString contained start=+"+ skip=+\\\\\|\\"+ end=+"+178 \ end="$" contains=asySpecial179 syn region asyCommentLCString contained start=+'+ skip=+\\\\\|\\'+ end=+'+180 \ end="$" contains=asyCSpecial181 syn region asyCommentL start="//" skip="\\$" end="$" keepend182 \ contains=asyTodo,asyCommentLString,183 \ asyCommentLCString,asyNumbers184 syn region asyComment matchgroup=asyComment start="/\*" end="\*/"185 \ contains=asyTodo,asyCommentStartError,186 \ asyCommentString,asyCommentCString,asyNumbers187else188 syn region asyCommentL start="//" skip="\\$" end="$" keepend189 \ contains=asyTodo190 syn region asyComment matchgroup=asyComment start="/\*" end="\*/"191 \ contains=asyTodo,asyCommentStartError192endif193 194" highlight common errors when starting/ending C comments195syn match asyCommentError display "\*/"196syn match asyCommentStartError display "/\*"me=e-1 contained197 198 199" delimiter matching errors200syn region asyCurly transparent start='{' end='}'201 \ contains=TOP,asyCurlyError202syn region asyBrack transparent start='\[' end='\]' matchgroup=asyError203 \ end=';' contains=TOP,asyBrackError204syn region asyParen transparent start='(' end=')' matchgroup=asyError205 \ end=';' contains=TOP,asyParenError206syn match asyCurlyError display '}'207syn match asyBrackError display '\]'208syn match asyParenError display ')'209" for (;;) constructs are exceptions that allow ; inside parenthesis210syn region asyParen transparent matchgroup=asyParen211 \ start='\(for\s*\)\@<=(' end=')'212 \ contains=TOP,asyParenError213 214" Define the default highlighting.215hi def link asyCommentL asyComment216hi def link asyConditional Conditional217hi def link asyRepeat Repeat218hi def link asyNumber Number219hi def link asyNumberError asyError220hi def link asyCurlyError asyError221hi def link asyBracketError asyError222hi def link asyParenError asyError223hi def link asyCommentError asyError224hi def link asyCommentStartError asyError225hi def link asyOperator Operator226hi def link asyStructure Structure227hi def link asyStorageClass StorageClass228hi def link asyExternal Include229hi def link asyDefine Macro230hi def link asyError Error231hi def link asyStatement Statement232hi def link asyType Type233hi def link asyConstant Constant234hi def link asyCommentString asyString235hi def link asyCommentCString asyString236hi def link asyCommentLString asyString237hi def link asyCommentLCString asyString238hi def link asyCommentSkip asyComment239hi def link asyString String240hi def link asyCString String241hi def link asyComment Comment242hi def link asySpecial SpecialChar243hi def link asyCSpecial SpecialChar244hi def link asyTodo Todo245hi def link asyPathSpec Statement246 247let b:current_syntax = "asy"248let &cpo = s:cpo_save249unlet s:cpo_save250 