3989c1cbff44edc8440fcec769b65c0be29b9191
[~madcoder/dotfiles.git] / vim / syntax / actionscript.vim
1 " Vim syntax file
2 " Language:     actionScript
3 " Maintainer:   Igor Dvorsky <amigo@modesite.net>
4 " URL:          http://www.modesite.net/vim/actionscript.vim
5 " Last Change:  2002 Sep 12
6 " Updated to support AS 2.0 2004 Mar 12 by Richard Leider  (richard@appliedrhetoric.com)
7 " Updated to support new AS 2.0 Flash 8 Language Elements 2005 September 29 (richard@appliedrhetoric.com)
8
9
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
12 if !exists("main_syntax")
13   if version < 600
14     syntax clear
15   elseif exists("b:current_syntax")
16   finish
17 endif
18   let main_syntax = 'actionscript'
19 endif
20
21 " based on "JavaScript" VIM syntax by Claudio Fleiner <claudio@fleiner.com>
22
23 syn case ignore
24 syn match   actionScriptLineComment                     "\/\/.*$"
25 syn match   actionScriptCommentSkip                     "^[ \t]*\*\($\|[ \t]\+\)"
26 syn region  actionScriptCommentString                   start=+"+  skip=+\\\\\|\\"+  end=+"+ end=+\*/+me=s-1,he=s-1 contains=actionScriptSpecial,actionScriptCommentSkip,@htmlPreproc
27 syn region  actionScriptComment2String                  start=+"+  skip=+\\\\\|\\"+  end=+$\|"+  contains=actionScriptSpecial,@htmlPreproc
28 syn region  actionScriptComment                         start="/\*"  end="\*/" contains=actionScriptCommentString,actionScriptCharacter,actionScriptNumber
29 syn match   actionScriptSpecial                         "\\\d\d\d\|\\."
30 syn region  actionScriptStringD                         start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=actionScriptSpecial,@htmlPreproc
31 syn region  actionScriptStringS                         start=+'+  skip=+\\\\\|\\'+  end=+'+  contains=actionScriptSpecial,@htmlPreproc
32 syn match   actionScriptSpecialCharacter                "'\\.'"
33 syn match   actionScriptNumber                          "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
34 syn keyword actionScriptConditional                     if else and or not
35 syn keyword actionScriptRepeat                          do while for in
36 syn keyword actionScriptCase                            break continue switch case default
37 syn keyword actionScriptConstructor                     new
38 syn keyword actionScriptObjects                         arguments Array Boolean Date _global Math Number Object String super var this Accessibility Color Key _level Mouse _root Selection Sound Stage System TextFormat LoadVars XML XMLSocket XMLNode LoadVars Button TextField TextSnapshot CustomActions Error ContextMenu ContextMenuItem NetConnection NetStream Video PrintJob MovieClipLoader StyleSheet Camera LocalConnection Microphone SharedObject MovieClip
39 syn keyword actionScriptStatement                       return with
40 syn keyword actionScriptFunction                        function on onClipEvent
41 syn keyword actionScriptValue                           true false undefined null NaN void
42 syn keyword actionScriptArray                           concat join length pop push reverse shift slice sort sortOn splice toString unshift
43 syn keyword actionScriptDate                            getDate getDay getFullYear getHours getMilliseconds getMinutes getMonth getSeconds getTime getTimezoneOffset getUTCDate getUTCDay getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getYear setDate setFullYear setHours setMilliseconds setMinutes setMonth setSeconds setTime setUTCDate setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds setYear UTC 
44 syn keyword actionScriptMath                            abs acos asin atan atan2 ceil cos E exp floor log LOG2E LOG10E LN2 LN10 max min PI pow random round sin sqrt SQRT1_2 SQRT2 tan -Infinity Infinity
45 syn keyword actionScriptNumberObj                       MAX_VALUE MIN_VALUE NaN NEGATIVE_INFINITY POSITIVE_INFINITY valueOf 
46 syn keyword actionScriptObject                          addProperty __proto__ registerClass toString unwatch valueOf watch
47 syn keyword actionScriptString                          charAt charCodeAt concat fromCharCode indexOf lastIndexOf length slice split substr substring toLowerCase toUpperCase add le lt gt ge eq ne chr mbchr mblength mbord mbsubstring ord
48 syn keyword actionScriptColor                           getRGB getTransform setRGB setTransform
49 syn keyword actionScriptKey                                     addListener BACKSPACE CAPSLOCK CONTROL DELETEKEY DOWN END ENTER ESCAPE getAscii getCode HOME INSERT isDown isToggled LEFT onKeyDown onKeyUp PGDN PGUP removeListener RIGHT SHIFT SPACE TAB UP ALT
50 syn keyword actionScriptMouse                           hide onMouseDown onMouseUp onMouseMove show onMouseWheel
51 syn keyword actionScriptSelection                       getBeginIndex getCaretIndex getEndIndex getFocus setFocus setSelection  
52 syn keyword actionScriptSound                           attachSound duration getBytesLoaded getBytesTotal getPan getTransform getVolume loadSound onLoad onSoundComplete position setPan setTransform setVolume start stop onID3
53 syn keyword actionScriptStage                           align height onResize scaleMode width
54 syn keyword actionScriptSystem                          capabilities hasAudioEncoder hasAccessibility hasAudio hasMP3 language manufacturer os pixelAspectRatio screenColor screenDPI screenResolution.x screenResolution.y version hasVideoEncoder security useCodepage exactSettings hasEmbeddedVideo screenResolutionX screenResolutionY input isDebugger serverString hasPrinting playertype hasStreamingAudio hasScreenBroadcast hasScreenPlayback hasStreamingVideo avHardwareDisable localFileReadDisable windowlesDisable
55 syn keyword actionScriptTextFormat                      align blockIndent bold bullet color font getTextExtent indent italic leading leftMargin rightMargin size tabStops target underline url  
56 syn keyword actionScriptCommunication           contentType getBytesLoaded getBytesTotal load loaded onLoad send sendAndLoad toString   addRequestHeader fscommand MMExecute
57 syn keyword actionScriptXMLSocket                       close connect onClose onConnect onData onXML
58 syn keyword actionScriptTextField                       autoSize background backgroundColor border borderColor bottomScroll embedFonts _focusrect getDepth getFontList getNewTextFormat getTextFormat hscroll html htmlText maxChars maxhscroll maxscroll multiline onChanged onScroller onSetFocus _parent password _quality removeTextField replaceSel replaceText restrict selectable setNewTextFormat setTextFormat text textColor textHeight textWidth type variable wordWrap condenseWhite mouseWheelEnabled textFieldHeight textFieldWidth ascent descent
59 syn keyword actionScriptMethods                         callee caller _alpha attachMovie beginFill beginGradientFill clear createEmptyMovieClip createTextField _currentframe curveTo _droptarget duplicateMovieClip enabled endFill focusEnabled _framesloaded getBounds globalToLocal gotoAndPlay gotoAndStop _height _highquality hitArea hitTest lineStyle lineTo loadMovie loadMovieNum loadVariables loadVariablesNum localToGlobal moveTo _name nextFrame onDragOut onDragOver onEnterFrame onKeyDown onKeyUp onKillFocus onMouseDown onMouseMove onMouseUp onPress onRelease onReleaseOutside onRollOut onRollOver onUnload play prevFrame removeMovieClip _rotation setMask _soundbuftime startDrag stopDrag swapDepths tabChildren tabIndex _target _totalframes trackAsMenu unloadMovie unloadMovieNum updateAfterEvent _url useHandCursor _visible _width _x _xmouse _xscale _y _ymouse _yscale tabEnabled asfunction call setInterval clearInterval setProperty stopAllSounds #initclip #endinitclip delete unescape escape eval apply prototype getProperty getTimer getURL getVersion ifFrameLoaded #include instanceof int new nextScene parseFloat parseInt prevScene print printAsBitmap printAsBitmapNum printNum scroll set targetPath tellTarget toggleHighQuality trace typeof isActive getInstanceAtDepth getNextHighestDepth getNextDepth getSWFVersion getTextSnapshot isFinite isNAN updateProperties _lockroot get install list uninstall showMenu onSelect builtInItems save zoom quality loop rewind forward_back customItems caption separatorBefore visible attachVideo bufferLength bufferTime currentFps onStatus pause seek setBuffertime smoothing time bytesLoaded bytesTotal addPage paperWidth paperHeight pageWidth pageHeight orientation loadClip unloadClip getProgress onLoadStart onLoadProgress onLoadComplete onLoadInit onLoadError styleSheet copy hideBuiltInItem transform activityLevel allowDomain allowInsecureDomain attachAudio bandwidth deblocking domain flush fps gain getLocal getRemote getSize index isConnected keyFrameInterval liveDelay loopback motionLevel motionTimeOut menu muted names onActivity onSync publish rate receiveAudio receiveVideo setFps setGain setKeyFrameInterval setLoopback setMode setMotionLevel setQuality setRate setSilenceLevel setUseEchoSuppression showSettings setClipboard silenceLevel silenceTimeOut useEchoSuppression
60 syn match   actionScriptBraces                          "([{}])"
61 syn keyword actionScriptException                       try catch finally throw name message
62 syn keyword actionScriptXML                                     attributes childNodes cloneNode createElement createTextNode docTypeDecl status firstChild hasChildNodes lastChild insertBefore nextSibling nodeName nodeType nodeValue parentNode parseXML previousSibling removeNode xmlDecl ignoreWhite
63 syn keyword actionScriptArrayConstant           CASEINSENSITIVE DESCENDING UNIQUESORT RETURNINDEXEDARRAY NUMERIC
64 syn keyword actionScriptStringConstant          newline
65 syn keyword actionScriptEventConstant           press release releaseOutside rollOver rollOut dragOver dragOut enterFrame unload mouseMove mouseDown mouseUp keyDown keyUp data
66 syn keyword actionScriptTextSnapshot            getCount setSelected getSelected getText getSelectedText hitTestTextNearPos findText setSelectColor
67 syn keyword actionScriptID3                             id3 artist album songtitle year genre track comment COMM TALB TBPM TCOM TCON TCOP TDAT TDLY TENC TEXT TFLT TIME TIT1 TIT2 TIT3 TKEY TLAN TLEN TMED TOAL TOFN TOLY TOPE TORY TOWN TPE1 TPE2 TPE3 TPE4 TPOS TPUB TRCK TRDA TRSN TRSO TSIZ TSRX TSSE TYER WXXX
68 syn keyword actionScriptAS2                             class extends public private static interface implements import dynamic
69 syn keyword actionScriptStyleSheet                      parse parseCSS getStyle setStyle getStyleNames
70 syn keyword flash8Functions                             onMetaData onCuePoint flashdisplay flashexternal flashfilters flashgeom flashnet flashtext addCallback applyFilter browse cancel clone colorTransform  containsPoint containsRectangle copyChannel copyPixels createBox createGradientBox deltaTransformPoint dispose download draw equals fillRect floodFill generateFilterRect getColorBoundsRect getPixel getPixel32 identity inflate inflatePoint interpolate intersection intersects invert isEmpty loadBitmap merge noise normalize offsetPoint paletteMap perlinNoise pixelDissolve polar rotate scale setAdvancedAntialiasingTable setEmpty setPixel setPixel32 subtract threshold transformPoint translate union upload
71 syn keyword flash8Constants                             ALPHANUMERIC_FULL ALPHANUMERIC_HALF CHINESE JAPANESE_HIRAGANA JAPANESE_KATAKANA_FULL JAPANESE_KATAKANA_HALF KOREAN UNKNOWN
72 syn keyword flash8Properties                            appendChild cacheAsBitmap opaqueBackground scrollRect keyPress #initclip #endinitclip kerning letterSpacing onHTTPStatus lineGradientStyle IME windowlessDisable hasIME hideBuiltInItems onIMEComposition getEnabled setEnabled getConversionMode setConversionMode setCompositionString doConversion idMap antiAliasType available bottom bottomRight concatenatedColorTransform concatenatedMatrix creationDate creator fileList maxLevel modificationDate pixelBounds rectangle rgb top topLeft attachBitmap beginBitmapFill blendMode filters getRect scale9Grid gridFitType sharpness thickness
73 syn keyword flash8Classes                               BevelFilter BitmapData BitmapFilter BlurFilter ColorMatrixFilter ColorTransform ConvolutionFilter DisplacementMapFilter DropShadowFilter ExternalInterface FileReference FileReferenceList GlowFilter GradientBevelFilter GradientGlowFilter Matrix Point Rectangle TextRenderer
74 syn keyword actionScriptInclude #include #initClip #endInitClip
75 " catch errors caused by wrong parenthesis
76 syn match   actionScriptInParen     contained "[{}]"
77 syn region  actionScriptParen       transparent start="(" end=")" contains=actionScriptParen,actionScript.*
78 syn match   actionScrParenError  ")"
79
80 if main_syntax == "actionscript"
81   syn sync ccomment actionScriptComment
82 endif
83
84 " Define the default highlighting.
85 " For version 5.7 and earlier: only when not done already
86 " For version 5.8 and later: only when an item doesn't have highlighting yet
87 if version >= 508 || !exists("did_actionscript_syn_inits")
88   if version < 508
89     let did_actionscript_syn_inits = 1
90     command -nargs=+ HiLink hi link <args>
91   else
92     command -nargs=+ HiLink hi def link <args>
93   endif
94   HiLink actionScriptComment            Comment
95   HiLink actionScriptLineComment        Comment
96   HiLink actionScriptSpecial            Special
97   HiLink actionScriptStringS            String
98   HiLink actionScriptStringD            String
99   HiLink actionScriptCharacter          Character
100   HiLink actionScriptSpecialCharacter   actionScriptSpecial
101   HiLink actionScriptNumber             actionScriptValue
102   HiLink actionScriptBraces             Function
103   HiLink actionScriptError              Error
104   HiLink actionScrParenError            actionScriptError
105   HiLink actionScriptInParen            actionScriptError
106   HiLink actionScriptConditional        Conditional
107   HiLink actionScriptRepeat             Repeat
108   HiLink actionScriptCase               Label
109   HiLink actionScriptConstructor        Operator
110   HiLink actionScriptObjects            Operator
111   HiLink actionScriptStatement          Statement
112   HiLink actionScriptFunction           Function
113   HiLink actionScriptValue              Boolean
114   HiLink actionScriptArray              Type
115   HiLink actionScriptDate               Type
116   HiLink actionScriptMath               Type
117   HiLink actionScriptNumberObj          Type
118   HiLink actionScriptObject             Function
119   HiLink actionScriptString             Type
120   HiLink actionScriptColor              Type
121   HiLink actionScriptKey                Type
122   HiLink actionScriptMouse              Type
123   HiLink actionScriptSelection          Type
124   HiLink actionScriptSound              Type
125   HiLink actionScriptStage              Type
126   HiLink actionScriptSystem             Type
127   HiLink actionScriptTextFormat         Type
128   HiLink actionScriptCommunication      Type
129   HiLink actionScriptXMLSocket          Type
130   HiLink actionScriptTextField          Type
131   HiLink actionScriptMethods            Statement
132   HiLink actionScriptException          Exception
133   HiLink actionScriptXML                        Type
134   HiLink actionScriptArrayConstant      Constant
135   HiLink actionScriptStringConstant     Constant
136   HiLink actionScriptEventConstant      Constant
137   HiLink actionScriptTextSnapshot       Type
138   HiLink actionScriptID3                        Type
139   HiLink actionScriptAS2                        Function
140   HiLink actionScriptStyleSheet         Type
141   HiLink flash8Constants                Constant
142   HiLink flash8Functions                Function
143   HiLink flash8Properties               Type
144   HiLink flash8Classes                  Type
145   HiLink actionScriptInclude            Include
146   delcommand HiLink
147 endif
148
149 let b:current_syntax = "actionscript"
150 if main_syntax == 'actionscript'
151   unlet main_syntax
152 endif
153
154 " vim: ts=8