diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | autoload/polyglot/init.vim | 4 | ||||
-rw-r--r-- | autoload/polyglot/sleuth.vim | 2 | ||||
-rw-r--r-- | indent/haxe.vim | 19 | ||||
-rw-r--r-- | packages.yaml | 11 | ||||
-rw-r--r-- | syntax/haxe.vim | 665 | ||||
-rw-r--r-- | syntax/haxe_extended.vim | 131 | ||||
-rw-r--r-- | syntax/hss.vim | 115 | ||||
-rw-r--r-- | syntax/hxml.vim | 90 | ||||
-rw-r--r-- | tests/filetypes.vim | 2 |
10 files changed, 627 insertions, 414 deletions
@@ -95,7 +95,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [handlebars](https://github.com/mustache/vim-mustache-handlebars) (Mustache and Handlebars syntax highlighting for mustache, hogan, hulk, hjs, handlebars, hbs, hdbs and hb files) - [haproxy](https://github.com/CH-DanReif/haproxy.vim) (HAProxy syntax highlighting) - [haskell](https://github.com/neovimhaskell/haskell-vim) (Haskell syntax highlighting for hs, hs-boot, hsc, bpk and hsig files) -- [haxe](https://github.com/yaymukund/vim-haxe) (Haxe syntax highlighting for hx and hxsl files) +- [haxe](https://github.com/jdonaldson/vaxe) (Haxe and HXML syntax highlighting for hx, hxsl, hxml and hss files) - [hcl](https://github.com/b4b4r07/vim-hcl) (HCL syntax highlighting for hcl, nomad and workflow files) - [helm](https://github.com/towolf/vim-helm) - [help](https://github.com/neovim/neovim/tree/master/runtime) diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim index afd2ea9d..6c2e9b87 100644 --- a/autoload/polyglot/init.vim +++ b/autoload/polyglot/init.vim @@ -112,6 +112,8 @@ if !exists('g:python_highlight_all') call s:SetDefault('g:python_slow_sync', 1) endif +" Some variables are needed for haxe loading + " We need it because scripts.vim in vim uses "set ft=" which cannot be " overridden with setf (and we can't use set ft= so our scripts.vim work) func! s:Setf(ft) @@ -2300,6 +2302,8 @@ endif if !has_key(g:polyglot_is_disabled, 'haxe') au BufNewFile,BufRead *.hx,*.hxsl setf haxe + au BufNewFile,BufRead *.hxml setf hxml + au BufNewFile,BufRead *.hss setf hss endif if !has_key(g:polyglot_is_disabled, 'haskell') diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim index 4e5538ea..66c78e1c 100644 --- a/autoload/polyglot/sleuth.vim +++ b/autoload/polyglot/sleuth.vim @@ -229,6 +229,7 @@ let s:globs = { \ 'hollywood': '*.hws', \ 'hostconf': '', \ 'hostsaccess': '', + \ 'hss': '*.hss', \ 'html': '*.html,*.htm,*.html.hl,*.inc,*.xht,*.xhtml', \ 'html.handlebars': '*.handlebars,*.hbs,*.hdbs,*.hb', \ 'html.mustache': '*.mustache,*.hogan,*.hulk,*.hjs', @@ -236,6 +237,7 @@ let s:globs = { \ 'htmldjango': '*.jinja,*.j2,*.jinja2', \ 'htmlm4': '*.html.m4', \ 'httest': '*.htt,*.htb', + \ 'hxml': '*.hxml', \ 'i3config': '*.i3.config,*.i3config,i3.config,i3config,.i3.config,.i3config', \ 'ibasic': '*.iba,*.ibi', \ 'icalendar': '*.ics', diff --git a/indent/haxe.vim b/indent/haxe.vim new file mode 100644 index 00000000..a8d3a5ff --- /dev/null +++ b/indent/haxe.vim @@ -0,0 +1,19 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'haxe', 'indent/haxe.vim') + finish +endif + +" Language: Haxe +" Maintainer: None! Wanna improve this? +" Last Change: 2007 Jan 22 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" C indenting is not too bad. +setlocal cindent +setlocal cinoptions+=j1,J1 +setlocal indentkeys=0{,0},0),0],!^F,o,O,e +let b:undo_indent = "setl cin<" diff --git a/packages.yaml b/packages.yaml index 8d0668fb..90c1333c 100644 --- a/packages.yaml +++ b/packages.yaml @@ -773,10 +773,19 @@ filetypes: - hsig --- name: haxe -remote: yaymukund/vim-haxe +remote: jdonaldson/vaxe filetypes: - name: haxe linguist: Haxe +- name: hxml + linguist: HXML +- name: hss + extensions: + - hss +ignored_dirs: + - ftplugin + - autoload + - compiler --- name: hcl remote: b4b4r07/vim-hcl diff --git a/syntax/haxe.vim b/syntax/haxe.vim index 0afda805..f18604b4 100644 --- a/syntax/haxe.vim +++ b/syntax/haxe.vim @@ -3,429 +3,270 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'haxe', 'syntax/haxe.vim') endif " Vim syntax file -" Language: haxe -" Derived from: -" http://tech.motion-twin.com/zip/haxe.vim -" and http://www.cactusflower.org/haxe.vim -" Please check :help haxe.vim for comments on some of the options available. +" Language: Haxe +" Maintainer: Luca Deltodesco <luca@deltaluca.me.uk> +" Last Change: 2013 August 26 -set errorformat=%f\:%l\:\ characters\ %c-%*[^\ ]\ %m,%f\:%l\:\ %m - -" Quit when a syntax file was already loaded -if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") +if exists("b:current_syntax") finish - endif - let main_syntax='haxe' endif +" provide fallback HiLink command if version < 508 command! -nargs=+ HaxeHiLink hi link <args> else command! -nargs=+ HaxeHiLink hi def link <args> endif -" some characters that cannot be in a haxe program (outside a string) -syn match haxeError "[\\@`]" -syn match haxeError "<<<\|=>\|<>\|||=\|&&=\|\*\/" - -" use separate name so that it can be deleted in haxecc.vim -syn match haxeError2 "#\|=<" -HaxeHiLink haxeError2 haxeError - -syn keyword haxeExternal import extern using -syn keyword haxeDefine package -syn keyword haxeConditional if else switch -syn keyword haxeRepeat while for do in -syn keyword haxeBoolean true false -syn keyword haxeConstant null -syn keyword haxeTypedef this super -syn keyword haxeOperator new cast -syn keyword haxeCoreType Void Bool Int Float Dynamic -syn keyword haxeStatement return - -syn keyword haxeTypedef1 typedef -syn keyword haxeStructure var enum -syn keyword haxeScopeDecl private public -syn keyword haxeScopeDecl2 static override final dynamic -syn keyword haxeFunctionDef function - -syn keyword haxeExceptions throw try catch finally untyped -syn keyword haxeAssert assert -syn keyword haxeMethodDecl synchronized throws -syn keyword haxeClassDecl extends implements interface -syn match haxeDelimiter "[;:=\.]" -syn match haxeOperator "\(\.\.\.\|\*\|+\|-\|<<\|>>\|\/\|!\|||\|&&\|%\)" -syn match haxeComparison "\(==\|<=\|>=\|<\|>\|!=\)" -syn match haxeOptionalVars contained "?[a-zA-Z_]\+" - -syn match haxeFunctionRef "[_$a-zA-Z][_$a-zA-Z0-9_]*("me=e-1 - -" We use a match here to differentiate the keyword class from MyClass.class -syn match haxeTypedef "\.\s*\<class\>"ms=s+1 -syn match haxeClassDecl "^class\>" -syn match haxeClassDecl "[^.]\s*\<class\>"ms=s+1 -syn keyword haxeBranch break continue nextgroup=haxeUserLabelRef skipwhite -syn match haxeUserLabelRef "\k\+" contained -syn match haxeClassDef "\(^\s*class\s*\)\@<=[_$a-zA-Z][_$a-zA-Z0-9_]*" contains=haxeTypedef,haxeClassDecl - -syn match haxeLangClass "\<System\>" -syn keyword haxeLangClass Array ArrayAccess Class Date DateTools EReg Enum -syn keyword haxeLangClass Hash IntHash IntIter Iterable Iterator Lambda -syn keyword haxeLangClass List Math Null Reflect Std String StringBug -syn keyword haxeLangClass StringTools Type UInt ValueType Xml XmlType - -syn keyword haxeFlashTop flash -syn keyword haxeFlashInner accessibility deskdop display errors events -syn keyword haxeFlashInner external filters geom media net printing sampler -syn keyword haxeFlashInner system text ui utils xml display engine -syn keyword haxeFlashFinal BitmapData ExternalInterface BevelFilter -syn keyword haxeFlashFinal BitmapFilter BlurFilter ColorMatrixFilter ConvolutionFilter -syn keyword haxeFlashFinal DisplacementMapFilter DropShadowFilter GlowFilter GradientBevelFilter -syn keyword haxeFlashFinal GradientGlowFilter ColorTransform Matrix Point Rectangle Transform -syn keyword haxeFlashFinal FileReference FileReferenceList Capabilities IME Security StyleSheet -syn keyword haxeFlashFinal TextRenderer Accessibility Boot Button Camera Color ContextMenu -syn keyword haxeFlashFinal ContextMenuItem ExtendedKey Key Lib LoadVars -syn keyword haxeFlashFinal LocalConnection Microphone Mouse MovieClip -syn keyword haxeFlashFinal MovieClipLoader NetConnection NetStream PrintJob -syn keyword haxeFlashFinal Selection SelectionListener SharedObject Sound -syn keyword haxeFlashFinal Stage System TextField TextFormat TextSnapshot -syn keyword haxeFlashFinal Video XMLRequest XMLSocket -syn keyword haxeFlash9Final Accessibility AccessibilityImplementation -syn keyword haxeFlash9Final AccessibilityProperties Clipboard -syn keyword haxeFlash9Final ClipboardFormats ClipboardTransferMode AVM1Movie -syn keyword haxeFlash9Final ActionScriptVersion Bitmap BitmapData -syn keyword haxeFlash9Final BitmapDataChannel BlendMode CapsStyle -syn keyword haxeFlash9Final DisplayObject DisplayObjectContainer FrameLabel -syn keyword haxeFlash9Final GradientType Graphics GraphicsBitmapFill -syn keyword haxeFlash9Final GraphicsEndFill GraphicsGradientFill GraphicsPath -syn keyword haxeFlash9Final GraphicsPathCommand GraphicsPathWinding -syn keyword haxeFlash9Final GraphicsShaderFill GraphicsSolidFill -syn keyword haxeFlash9Final GraphicsStroke GraphicsTrianglePath -syn keyword haxeFlash9Final IBitmapDrawable IGraphicsData IGraphicsFill -syn keyword haxeFlash9Final IGraphicsPath IGraphicsStroke InteractiveObject -syn keyword haxeFlash9Final InterpolationMethod JointStyle -syn keyword haxeFlash9Final LineScaleMode Loader LoaderInfo MorphShape -syn keyword haxeFlash9Final MovieClip PixelSnapping SWFVersion -syn keyword haxeFlash9Final Scene Shader ShaderData ShaderInput ShaderJob ShaderParameter -syn keyword haxeFlash9Final ShaderParameterType ShaderPrecision Shape -syn keyword haxeFlash9Final SimpleButton SpreadMethod Sprite -syn keyword haxeFlash9Final Stage StageAlign StageDisplayState StageQuality -syn keyword haxeFlash9Final StageScaleMode TriangleCulling -syn keyword haxeFlash9Final EOFError Error IOError Illegal OperationError -syn keyword haxeFlash9Final InvalidSWFError MemoryError ScriptTimeoutError -syn keyword haxeFlash9Final StackOverflowError ActivityEventAsyncErrorEvent -syn keyword haxeFlash9Final ContextMenuEvent DataEvent ErrorEvent Event -syn keyword haxeFlash9Final EventDispatcher EventPhase FocusEvent -syn keyword haxeFlash9Final FullScreenEvent HTTPStatusEvent IEventDispatcher IMEEvent -syn keyword haxeFlash9Final IOErrorEvent KeyboardEvent MouseEvent -syn keyword haxeFlash9Final NetFilterEvent NetStatusEvent ProgressEvent -syn keyword haxeFlash9Final SampleDataEvent SecurityErrorEvent ShaderEvent StatusEvent -syn keyword haxeFlash9Final SyncEvent TextEvent TimerEvent WeakFunctionClosure WeakMethodClosure -syn keyword haxeFlash9Final ExternalInterface BevelFilter BitmapFilter -syn keyword haxeFlash9Final BitmapFilterQuality BitmapFilterType -syn keyword haxeFlash9Final BlurFilter ColorMatrixFilter ConvolutionFilter DisplacementMapFilter -syn keyword haxeFlash9Final DisplacementMapFilterMode DropShadowFilter -syn keyword haxeFlash9Final GlowFilter GradientBevelFilter -syn keyword haxeFlash9Final GradientGlowFilter ShaderFilter ColorTransform -syn keyword haxeFlash9Final Matrix Matrix3D Orientation3D -syn keyword haxeFlash9Final PerspectiveProjection Point Rectangle Transform -syn keyword haxeFlash9Final Utils3D Vector3D Camera ID3Info -syn keyword haxeFlash9Final Microphone Sound SoundChannel SoundCodec SoundLoaderContext SoundMixer -syn keyword haxeFlash9Final SoundTransform Video DynamicPropertyOutput FileFilter FileReference -syn keyword haxeFlash9Final FileReferenceList IDynamicPropertyOutput -syn keyword haxeFlash9Final IDynamicPropertyWriter LocalConnection -syn keyword haxeFlash9Final NetConnection NetStream NetStreamInfo NetSTreamPlayOptions -syn keyword haxeFlash9Final NetSTreamPlayTransitions ObjectEncoding Responder SharedObject -syn keyword haxeFlash9Final SharedObjectFlushStatus Socket URLLoader URLLoaderDataFormat URLRequest -syn keyword haxeFlash9Final URLRequestHeader URLRequestMethod URLStream -syn keyword haxeFlash9Final URLVariables XMLSocket PrintJob -syn keyword haxeFlash9Final PrintJobOptions PrintJobOrientation Api -syn keyword haxeFlash9Final DeleteObjectSample NewObjectSample -syn keyword haxeFlash9Final Sample StackFrame ApplicationDomain Capabilities FSCommand IME -syn keyword haxeFlash9Final IMEConversionMode JPEGLoaderContext -syn keyword haxeFlash9Final LoaderContext Security SecurityDomain -syn keyword haxeFlash9Final SecurityPanel System -syn keyword haxeFlash9Final BreakOpportunity CFFHinting ContentElement -syn keyword haxeFlash9Final DigitCase DigitWidth EastAsianJustifier ElementFormat FontDescription -syn keyword haxeFlash9Final FontLookup FontMetrics FontPosture FontWeight -syn keyword haxeFlash9Final GraphicElement GroupElement -syn keyword haxeFlash9Final JustificationStyle Kerning LIgatureLevel -syn keyword haxeFlash9Final LineJustification RenderingMode -syn keyword haxeFlash9Final SpaceJustifier TabAlignment TabStop TextBaseline TextBlock TextElement -syn keyword haxeFlash9Final TextJustifier TextLine TextLineCreationResult TextLineMirrorRegion -syn keyword haxeFlash9Final TextLineValidity TextRotation TypographicCase -syn keyword haxeFlash9Final AntiAliasType CSMSettings Font -syn keyword haxeFlash9Final FontStyle FontType GridFitType StaticText StyleSheet TextColorType -syn keyword haxeFlash9Final TextDisplayMode TextExtent TextField -syn keyword haxeFlash9Final TextFieldAutoSize TextFieldType TextFormat -syn keyword haxeFlash9Final TextFormatAlign TextFormatDisplay TextLineMetrics TextRenderer TextRun -syn keyword haxeFlash9Final TextSnapshot Trace ContextMenu ContextMenuBuiltInItems -syn keyword haxeFlash9Final ContextMenuClipboardItems ContextMenuItem KeyLocation Keyboard Mouse -syn keyword haxeFlash9Final MouseCursor ByteArray Dictionary Endian -syn keyword haxeFlash9Final IDataInput IDataOutput IExternalizable -syn keyword haxeFlash9Final Namespace ObjectInput ObjectOutput Proxy QName SetIntervalTimer Timer -syn keyword haxeFlash9Final TypedDictionary XML XMLDocument XMLList XMLNode -syn keyword haxeFlash9Final XMLNodeType XMLParser XMLTag -syn keyword haxeFlash9Final Boot Lib Memory Vector - -HaxeHiLink haxeLangObject haxeConstant -syn cluster haxeTop add=haxeLangObject,haxeLangClass -syn cluster haxeClasses add=haxeLangClass,haxeFlashClass - -if filereadable(expand("<sfile>:p:h")."/haxeid.vim") - source <sfile>:p:h/haxeid.vim -endif - -if !exists("haxe_no_trail_space_error") - syn match haxeSpaceError "\s\+$" -endif -if !exists("haxe_no_tab_space_error") - syn match haxeSpaceError " \+\t"me=e-1 -endif - -syn region haxeLabelRegion transparent matchgroup=haxeLabel start="\<case\>" - \ matchgroup=NONE end=":" - \ contains=haxeNumber,haxeChr,haxeNumber2 -syn match haxeUserLabel "\({\s*\|^\s*\|,\s*\)\@<=[_$a-zA-Z][_$a-zA-Z0-9_]*:\s"he=e-1 contains=haxeDelimiter - \ contains=haxeLabel -syn keyword haxeLabel default never - -" Everything - used in parenthases checking or something -syn cluster haxeTop add=haxeExternal,haxeError,haxeError,haxeBranch, - \ haxeLabelRegion,haxeLabel,haxeConditional, - \ haxeRepeat,haxeBoolean,haxeConstant, - \ haxeTypedef,haxeOperator,haxeType,haxeCoreType, - \ haxeStatement,haxeStorageClass,haxeAssert, - \ haxeExceptions,haxeMethodDecl,haxeClassDecl, - \ haxeClassDecl,haxeClassDecl,haxeScopeDecl, - \ haxeError,haxeError2,haxeUserLabel, - \ haxeLangObject,haxeFlashTop,haxeFlashInner, - \ haxeFlashFinal,haxeFlash9Final,haxeFunctionRef, - \ haxeComparison,haxeOptionalVars - -" Comments -syn keyword haxeTodo contained TODO FIXME XXX -if exists("haxe_comment_strings") - syn region haxeCmString contained start=+"+ end=+"+ end=+$+ - \ end=+\*/+me=s-1,he=s-1 - \ contains=haxeSpecial,haxeCmStar,haxeSpecChr,@Spell - syn region haxeCm2String contained start=+"+ end=+$\|"+ - \ contains=haxeSpecial,haxeSpecChr,@Spell - syn match haxeCmCharacter contained "'\\[^']\{1,6\}'" contains=haxeSpecChr - syn match haxeCmCharacter contained "'\\''" contains=haxeSpecChr - syn match haxeCmCharacter contained "'[^\\]'" - syn cluster haxeCmSpecial add=haxeCmString,haxeCmCharacter,haxeNumber,haxeNumber2 - syn cluster haxeCmSpecial2 add=haxeCm2String,haxeCmCharacter,haxeNumber,haxeNumber2 -endif -syn region haxeCm start="/\*" end="\*/" - \ contains=@haxeCmSpecial,haxeTodo,@Spell -syn match haxeCmStar contained "^\s*\*[^/]"me=e-1 -syn match haxeCmStar contained "^\s*\*$" -syn match haxeLineCm "//.*" contains=@haxeCmSpecial2,haxeTodo,@Spell -HaxeHiLink haxeCmString haxeDocTags -HaxeHiLink haxeCm2String haxeString -HaxeHiLink haxeCmCharacter haxeChr -syn cluster haxeTop add=haxeCm,haxeLineCm -if exists("haxe_haxedoc") || main_syntax == 'jsp' - syntax case ignore - " syntax coloring for haxedoc comments (HTML) - " syntax include @haxeHtml <sfile>:p:h/html.vim - " unlet b:current_syntax - syn region haxeDocCm start="/\*\*" end="\*/" keepend - \ contains=haxeCmTitle,@haxeHtml,haxeDocTags,haxeTodo,@Spell,haxeProposedTags - syn region haxeCmTitle contained matchgroup=haxeDocCm start="/\*\*" - \ matchgroup=haxeCmTitle keepend end="\.$" - \ end="\.[ \t\r<]"me=e-1 - \ end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 - \ contains=@haxeHtml,haxeCmStar,haxeTodo,@Spell,haxeDocTags,haxeProposedTags - syn region haxeDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" - \ end="}" - syn match haxeDocTags contained "@\(see\|param\|exception\|throws\|since\)\s\+\S\+" - \ contains=haxeDocParam - syn match haxeDocParam contained "\s\S\+" - syn match haxeDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>" - syn match haxeProposedTags contained "@\(category\|example\|tutorial\|index\|exclude\|todo\|internal\|obsolete\)\>" - syntax case match -endif -syn match haxeCm "/\*\*/" " Edge case - - -" Strings and constants -syn match haxeSpecError contained "\\." -"syn match haxeSpecChrError contained "[^']" -syn match haxeSpecChr contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)" -syn match haxeEregEscape contained "\(\\\\\|\\/\)" -syn region haxeEreg start=+\~\/+ end=+\/[gims]*+ contains=haxeEregEscape - -syn region haxeString start=+"+ end=+"+ contains=haxeSpecChr,haxeSpecError,@Spell -syn region haxeSingleString start=+'+ end=+'+ -syn match haxeChr "'[^']*'" contains=haxeSpecChr,haxeSpecChrError -syn match haxeChr "'\\''" contains=haxeSpecChr -syn match haxeChr "'[^\\]'" -syn match haxeNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" contains=haxeSpecNum -"syn match haxeNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" -syn match haxeNumber2 "\(\<\d\+\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" contains=haxeSpecNum -syn match haxeNumber2 "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" contains=haxeSpecNum -syn match haxeNumber2 "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" contains=haxeSpecNum -syn match haxeSpecNum contained "\(0[xX]\|[\.+-]\)" - -syn region haxeCondIf start="#if \+!\?" end="\(\W\|$\)" skip="([A-Za-z0-9_ |&!]\+)" -syn region haxeCondElseIf start="#elseif \+!\?" end="\(\W\|$\)" skip="([A-Za-z0-9_ |&!]\+)" -syn match haxeCondElse "#else\s*$" -syn match haxeCondEnd "#end" -syn match haxeCondError "#else .*$" - -" unicode characters -syn match haxeSpecial "\\u\d\{4\}" - -syn match haxeType ":[a-zA-Z_\.]\+" - \ contains=haxeDelimiter,haxeCoreType,haxeFlashTop,haxeFlashInner,haxeFlashFinal,haxeFlash9Final - -syn cluster haxeTop add=haxeString,haxeChr,haxeNumber,haxeNumber2 -syn cluster haxeTop add=haxeSpecial,haxeStringError,haxeDelimiter,haxeType - -syn keyword haxeTraceFun trace contained -syn region haxeTrace start=+\(^\s*\)\@<=trace(+ end=+);+ contains=haxeTraceFun - -if exists("haxe_highlight_functions") - if haxe_highlight_functions == "indent" - syn match haxeFuncDef "^\(\t\| \{4\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" - \ contains=haxeType,haxeStorageClass,@haxeClasses - syn region haxeFuncDef start=+^\(\t\| \{4\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ - \ end=+)+ contains=haxeType,haxeStorageClass,@haxeClasses - syn match haxeFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" - \ contains=haxeType,haxeStorageClass,@haxeClasses - syn region haxeFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ - \ end=+)+ - \ contains=haxeType,haxeStorageClass,@haxeClasses - 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) - syn region haxeFuncDef start=+\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*(+ - \ end=+)+ - \ contains=haxeType,haxeStorageClass,haxeCm,haxeLineCm,@haxeClasses - endif - syn match haxeBraces "[{}]" - syn cluster haxeTop add=haxeFuncDef,haxeBraces -endif - -if exists("haxe_mark_braces_in_parens_as_errors") - syn match haxeInParen contained "[{}]" - HaxeHiLink haxeInParen haxeError - syn cluster haxeTop add=haxeInParen -endif - -" catch errors caused by wrong parenthesis -syn region haxeParenT transparent matchgroup=haxeParen start="(" - \ end=")" contains=@haxeTop,haxeParenT1 -syn region haxeParenT1 transparent matchgroup=haxeParen1 start="(" - \ end=")" contains=@haxeTop,haxeParenT2 contained -syn region haxeParenT2 transparent matchgroup=haxeParen2 start="(" - \ end=")" contains=@haxeTop,haxeParenT contained -syn match haxeParenError ")" -HaxeHiLink haxeParenError haxeError - - -if !exists("haxe_minlines") - let haxe_minlines = 5000 -endif -exec "syn sync ccomment haxeCm minlines=" . haxe_minlines -syn sync linebreaks=30 - -" The default highlighting. -if version >= 508 || !exists("did_haxe_syn_inits") - if version < 508 - let did_haxe_syn_inits = 1 - endif - - HaxeHiLink haxeFunctionDef Identifier - HaxeHiLink haxeFuncDef Identifier - HaxeHiLink haxeFunctionRef Function - HaxeHiLink haxeBraces Function - HaxeHiLink haxeBranch Conditional - HaxeHiLink haxeUserLabelRef haxeUserLabel - HaxeHiLink haxeLabel Label - HaxeHiLink haxeUserLabel Label - HaxeHiLink haxeConditional Conditional - HaxeHiLink haxeRepeat Repeat - HaxeHiLink haxeExceptions Exception - HaxeHiLink haxeAssert Statement - - HaxeHiLink haxeClassDef Underlined - HaxeHiLink haxeStructure Structure - HaxeHiLink haxeMethodDecl haxeStorageClass - HaxeHiLink haxeClassDecl Structure - HaxeHiLink haxeScopeDecl StorageClass - HaxeHiLink haxeScopeDecl2 Tag - HaxeHiLink haxeBoolean Boolean - HaxeHiLink haxeSpecial Special - HaxeHiLink haxeSpecError Error - HaxeHiLink haxeSpecChrError Error - HaxeHiLink haxeString String - HaxeHiLink haxeSingleString Character - - HaxeHiLink haxeEreg Number - HaxeHiLink haxeEregEscape Debug - HaxeHiLink haxeChr Character - HaxeHiLink haxeSpecChr SpecialChar - HaxeHiLink haxeNumber Number - HaxeHiLink haxeNumber2 Float - HaxeHiLink haxeSpecNum Boolean - HaxeHiLink haxeError Error - HaxeHiLink haxeStringError Debug - HaxeHiLink haxeStatement Statement - HaxeHiLink haxeOperator Operator - HaxeHiLink haxeComparison Repeat - HaxeHiLink haxeTraceFun SpecialComment - HaxeHiLink haxeTrace Comment - HaxeHiLink haxeDelimiter Delimiter - - HaxeHiLink haxeCm Comment - HaxeHiLink haxeDocCm Comment - HaxeHiLink haxeLineCm Comment - HaxeHiLink haxeConstant Constant - HaxeHiLink haxeTypedef Typedef - HaxeHiLink haxeTypedef1 Typedef - HaxeHiLink haxeTodo Todo - HaxeHiLink haxeLangClass Special - HaxeHiLink haxeFlashClass Keyword - HaxeHiLink haxeFunction Function - HaxeHiLink haxeCmTitle Special - HaxeHiLink haxeDocTags SpecialComment - HaxeHiLink haxeProposedTags SpecialComment - HaxeHiLink haxeCmStar Comment - - HaxeHiLink haxeDocParam Function - HaxeHiLink haxeCoreType Keyword - HaxeHiLink haxeType Type - HaxeHiLink haxeExternal Include - HaxeHiLink haxeDefine Define - HaxeHiLink htmlComment Special - HaxeHiLink htmlCommentPart Special - HaxeHiLink haxeSpaceError Error - HaxeHiLink haxeCondIf PreCondit - HaxeHiLink haxeCondElseIf PreCondit - HaxeHiLink haxeCondElse PreProc - HaxeHiLink haxeCondEnd PreProc +" characters that cannot be in a haxe program (outside a string) +syn match haxeError "[\\`]" + +" keywords +" -------- +syn keyword haxeTypedef typedef extends implements +syn keyword haxeTypeDecl class enum abstract interface import using package from to +syn keyword haxeStorageClass static inline public private macro dynamic extern override final + +syn match haxeTypedef "\.\s*\<class\>"ms=s+1 +syn match haxeTypeDecl "^class\>" +syn match haxeTypeDecl "[^.]\s*\<class\>"ms=s+1 + +syn keyword haxeException try catch throw +syn keyword haxeRepeat for do while in +syn keyword haxeLabel case +syn keyword haxeConditional switch +syn match haxeConditional "\<\#\@<!\(if\|else\)\>" +syn keyword haxeConstant null never super this default get set +syn keyword haxeFunction function __dollar__new new +syn match haxeFunction "\<__[^_]\+__\>" +syn keyword haxeKeyword untyped cast continue break return trace var +syn match haxeKeyword "\$type" + +syn match haxeError "\<#\@<!elseif\>" + +" type identifiers +" ---------------- +syn match haxeType "\<[A-Z][a-zA-Z_0-9]*\>" + +" operators +" --------- +" Did a lot of work here to ensure a lot of invalid operators are highlighted as errors. + +" put ,; in seperate highlight group to .: to avoid mistakes. +syn match haxeOperator "[:?]" +syn match haxeOperator2 "[;,]" + +" match . and ... as operators, and .. and more than 4 . as errors +syn match haxeOperator "\.\@<!\(\.\|\.\.\.\)\.\@!" +syn match haxeError "\.\@<!\.\.\.\@!" +syn match haxeError "\.\{4,\}" + +" match <,>,<<,>>,>>> as operators +syn match haxeOperator ">\@<!\(>\|>>\|>>>\)>\@!" +syn match haxeOperator "<\@<!\(<\|<<\)<\@!" + +" match &| in 1 or 2 as operator, and more than 2 as error +" match &&= and ||= as errors +syn match haxeOperator "&\@<!&&\?&\@!" +syn match haxeOperator "|\@<!||\?|\@!" +syn match haxeError "&\{3,\}\||\{3,}\|&&=\|||=" + +" match = in 1 or 2 as operator, and more than 2 as error +" match !== as an error +syn match haxeOperator "=\@<!==\?=\@!" +syn match haxeError "=\{3,\}\|!==" + +" match (+-*/%&!<>)=? as operators +" have to match &!<> seperate to avoid highlighting things like &&= &&& <<< as okay +syn match haxeOperator "[+\-*/%^!]=\?=\@!" +syn match haxeOperator "<\@<!<=\?[=<]\@!" +syn match haxeOperator ">\@<![>]=\?[=>]\@!" +syn match haxeOperator "&\@<!&=\?[=&]\@!" +syn match haxeOperator "|\@<!|=\?[=|]\@!" + +" string literals +" --------------- +" Did a lot of work to ensure that string interpolations are handled nicely +syn match haxeErrorCharacter contained "\\\(x.\{0,2}\|u.\{0,4\}\|[^"'\\/nrt]\)" +syn match haxeSpecialCharacter contained "\\\(x[a-fA-F0-9]\{2\}\|[0-7]\{3\}\|["'\\/nrt]\)" +syn match haxeIntSpecialChar contained "\$\@<!\(\$\$\)\+\(\(\$\$\)\+\)\@!" +syn match haxeInterpolatedIdent contained "\((\$\$)\+\)\@<!\$[a-zA-Z_][a-zA-Z_0-9]*" +syn region haxeInterpolated contained start=+\(\$\(\$\$\)\+\)\@<!${+ end=+}+ contains=@Spell +syn region haxeDString start=+"+ end=+"+ contains=haxeSpecialCharacter,haxeErrorCharacter,@Spell +syn region haxeSString start=+'+ end=+'+ contains=haxeSpecialCharacter,haxeErrorCharacter,haxeIntSpecialChar,haxeInterpolatedIdent,haxeInterpolated,@Spell + +" int/float/bool literal +" ---------------------- +syn match haxeInt "\<\([0-9]\+\|0x[0-9a-fA-F]\+\)\>" +syn match haxeFloat "\<\([\-+]\?[0-9]*\.\?[0-9]\+([eE][\-+]\?[0-9]\+)\?\)\>" +syn keyword haxeBool true false + +" comments +" -------- +syn keyword haxeTODO contained TODO FIXME XXX +syn match haxeComment "//.*" contains=haxeTODO,@Spell +syn region haxeComment2 start=+/\*+ end=+\*/+ contains=haxeTODO,@Spell + +" preprocessing +" ------------- +syn match haxePre "\(#if\|#elseif\|#else\|#end\)" +syn match haxePreError "#error" + +" regex +" ----- +syn region haxeRegex start=+\~\/+ end=+\/+ contains=haxeRegexEscape,haxeRegexError,@Spell + +syn match haxeRegexError contained "\\[^0-9bdnrstwxBDSW(){}\[\]\\$^*\-+|./?]" +syn match haxeRegexEscape contained "\\[0-9bdnrstwxBDSW(){}\[\]\\$^*\-+|./?]" + +" meta +" ---- +syn match haxeMeta "@:\?[a-zA-Z_][a-zA-Z_0-9]*\>" + +syn match haxeCompilerMeta "@:\( + \abstract + \\|access + \\|allow + \\|annotation + \\|arrayAccess + \\|autoBuild + \\|bind + \\|bitmap + \\|build + \\|buildXml + \\|callable + \\|classCode + \\|commutative + \\|compilerGenerated + \\|coreApi + \\|coreType + \\|cppFileCode + \\|cppNamespaceCode + \\|dce + \\|debug + \\|decl + \\|defParam + \\|delegate + \\|depend + \\|deprecated + \\|event + \\|enum + \\|expose + \\|extern + \\|fakeEnum + \\|file + \\|final + \\|font + \\|forward + \\|from + \\|functionCode + \\|functionTailCode + \\|generic + \\|genericBuild + \\|getter + \\|hack + \\|headerClassCode + \\|headerCode + \\|headerNamespaceCode + \\|hxGen + \\|ifFeature + \\|include + \\|initPackage + \\|internal + \\|isVar + \\|jsRequire + \\|keep + \\|keepInit + \\|keepSub + \\|luaRequire + \\|macro + \\|meta + \\|multiType + \\|multiReturn + \\|native + \\|nativeGen + \\|noCompletion + \\|noDebug + \\|noDoc + \\|noImportGlobal + \\|noPackageRestrict + \\|noStack + \\|noUsing + \\|notNull + \\|ns + \\|op + \\|optional + \\|overload + \\|privateAccess + \\|property + \\|protected + \\|public + \\|publicFields + \\|readOnly + \\|remove + \\|require + \\|rtti + \\|runtime + \\|runtimeValue + \\|selfCall + \\|setter + \\|sound + \\|struct + \\|suppressWarnings + \\|throws + \\|to + \\|transient + \\|unbound + \\|unifyMinDynamic + \\|unreflective + \\|unsafe + \\|usage + \\|volatile + \\)\>" + + +syn sync ccomment haxeComment2 minlines=10 + +HaxeHiLink haxeMeta Macro +HaxeHiLink haxeCompilerMeta Identifier +HaxeHiLink haxeRegex String +HaxeHiLink haxeDString String +HaxeHiLink haxeSString Character +HaxeHiLink haxeSpecialCharacter SpecialChar +HaxeHiLink haxeIntSpecialChar SpecialChar +HaxeHiLink haxeRegexEscape SpecialChar +HaxeHiLink haxeErrorCharacter Error +HaxeHiLink haxeRegexError Error +HaxeHiLink haxeInterpolatedIdent Normal +HaxeHiLink haxeInterpolated Normal +HaxeHiLink haxeError Error +HaxeHiLink haxeOperator Operator +HaxeHiLink haxeOperator2 Identifier +HaxeHiLink haxeSpecial SpecialChar +HaxeHiLink haxeInt Number +HaxeHiLink haxeFloat Float +HaxeHiLink haxeBool Boolean +HaxeHiLink haxeComment Comment +HaxeHiLink haxeComment2 Comment +HaxeHiLink haxeTODO Todo +HaxeHiLink haxePre PreCondit +HaxeHiLink haxePreError PreProc +HaxeHiLink haxeType Type +HaxeHiLink haxeTypedef Typedef +HaxeHiLink haxeTypeDecl Keyword " Structure just gives me same colour as Type and looks bad. +HaxeHiLink haxeStorageClass StorageClass +HaxeHiLink haxeException Exception +HaxeHiLink haxeRepeat Repeat +HaxeHiLink haxeLabel Label +HaxeHiLink haxeConditional Conditional +HaxeHiLink haxeConstant Constant +HaxeHiLink haxeFunction Function +HaxeHiLink haxeKeyword Keyword - HaxeHiLink haxeCondError Error +delcommand HaxeHiLink - HaxeHiLink haxeFlashTop PreProc - HaxeHiLink haxeFlashInner Macro - HaxeHiLink haxeFlashFinal Define - HaxeHiLink haxeFlash9Final Define +let b:current_syntax = "haxe" +let b:spell_options = "contained" - HaxeHiLink haxeOptionalVars Identifier -endif -delcommand HaxeHiLink -let b:current_syntax = "haxe" -if main_syntax == 'haxe' - unlet main_syntax -endif -let b:spell_options="contained" +" vim: ts=8 diff --git a/syntax/haxe_extended.vim b/syntax/haxe_extended.vim new file mode 100644 index 00000000..6fac9a8d --- /dev/null +++ b/syntax/haxe_extended.vim @@ -0,0 +1,131 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'haxe', 'syntax/haxe_extended.vim') + finish +endif + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Haxedoc +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if exists("haxe_haxedoc") || (exists("main_syntax") && main_syntax == 'jsp') + syntax case ignore + " syntax coloring for haxedoc comments (HTML) + " syntax include @haxeHtml <sfile>:p:h/html.vim + " unlet b:current_syntax + syn region haxeDocComment start="/\*\*" end="\*/" keepend contains=haxeCommentTitle,@haxeHtml,haxeDocTags,haxeTodo,@Spell + syn region haxeCommentTitle contained matchgroup=haxeDocComment start="/\*\*" matchgroup=haxeCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@haxeHtml,haxeCommentStar,haxeTodo,@Spell,haxeDocTags + + syn region haxeDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" + syn match haxeDocTags contained "@\(see\|param\|exception\|throws\|since\)\s\+\S\+" contains=haxeDocParam + syn match haxeDocParam contained "\s\S\+" + syn match haxeDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>" + syntax case match + HaxeHiLink haxeDocComment Comment + HaxeHiLink haxeDocTags Special + HaxeHiLink haxeDocParam Function +endif + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Haxe comment strings +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if exists("haxe_comment_strings") + syn region haxeCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=haxeSpecial,haxeCommentStar,haxeSpecialChar,@Spell + syn region haxeComment2String contained start=+"+ end=+$\|"+ contains=haxeSpecial,haxeSpecialChar,@Spell + syn match haxeCommentCharacter contained "'\\[^']\{1,6\}'" contains=haxeSpecialChar + syn match haxeCommentCharacter contained "'\\''" contains=haxeSpecialChar + syn match haxeCommentCharacter contained "'[^\\]'" + syn cluster haxeCommentSpecial add=haxeCommentString,haxeCommentCharacter,haxeNumber + syn cluster haxeCommentSpecial2 add=haxeComment2String,haxeCommentCharacter,haxeNumber + HaxeHiLink haxeCommentString haxeString + HaxeHiLink haxeComment2String haxeString +endif + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Haxe concealed text +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if exists('g:haxe_conceal') && has("conceal") + syn match Ignore 'urn' transparent conceal containedin=haxeStatement + syn match Ignore 'ction' transparent conceal containedin=haxeStorageClass,haxeStatement + syn match Ignore 'ati' transparent conceal containedin=haxeStorageClass + syn match Ignore 'nline\|tati\|ubli' transparent conceal containedin=haxeScopeDecl +endif + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Haxe space errors +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if exists("haxe_space_errors") + if !exists("haxe_no_trail_space_error") + syn match haxeSpaceError "\s\+$" + endif + if !exists("haxe_no_tab_space_error") + syn match haxeSpaceError " \+\t"me=e-1 + endif + HaxeHiLink haxeSpaceError Error +endif + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Haxe minline comments +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if !exists("haxe_minlines") + let haxe_minlines = 10 + exec "syn sync ccomment haxeComment minlines=" . haxe_minlines +endif + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Mark braces in parens as errors +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if exists("haxe_mark_braces_in_parens_as_errors") + syn match haxeInParen contained "[{}]" + HaxeHiLink haxeInParen haxeError + syn cluster haxeTop add=haxeInParen +endif + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Highlight Functions +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if exists("haxe_highlight_functions") + if haxe_highlight_functions == "indent" + syn match haxeFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=haxeScopeDecl,haxeType,haxeStorageClass,@haxeClasses + syn region haxeFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=haxeScopeDecl,haxeType,haxeStorageClass,@haxeClasses + syn match haxeFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=haxeScopeDecl,haxeType,haxeStorageClass,@haxeClasses + syn region haxeFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=haxeScopeDecl,haxeType,haxeStorageClass,@haxeClasses + 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) + syn region haxeFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|override\|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*(+ end=+)+ contains=haxeScopeDecl,haxeType,haxeStorageClass,haxeComment,haxeLineComment,@haxeClasses + endif + syn match haxeBraces "[{}]" + syn cluster haxeTop add=haxeFuncDef,haxeBraces +endif + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Add special handling for haxecc.vim +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" use separate name so that it can be deleted in haxecc.vim +syn match haxeError2 "#\|=<" +HaxeHiLink haxeError2 haxeError + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Catch extra paren errors +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" catch errors caused by wrong parenthesis +syn region haxeParenT transparent matchgroup=haxeParen start="(" end=")" contains=@haxeTop,haxeParenT1,haxeString,haxeSingleString +syn region haxeParenT1 transparent matchgroup=haxeParen1 start="(" end=")" contains=@haxeTop,haxeParenT2 contained +syn region haxeParenT2 transparent matchgroup=haxeParen2 start="(" end=")" contains=@haxeTop,haxeParenT contained +syn match haxeParenError ")" +HaxeHiLink haxeParenError haxeError + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" load a spearte haxeid.vim file +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if filereadable(expand("<sfile>:p:h")."/haxeid.vim") + source <sfile>:p:h/haxeid.vim +endif diff --git a/syntax/hss.vim b/syntax/hss.vim new file mode 100644 index 00000000..1d04f48f --- /dev/null +++ b/syntax/hss.vim @@ -0,0 +1,115 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'haxe', 'syntax/hss.vim') + finish +endif + +" Vim syntax file +" Language: hss (Haxe css) +" Author: Justin Donaldson (jdonaldson@gmail.com) +" Based heavily on work by Daniel Hofstetter (daniel.hofstetter@42dh.com) + +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = 'hss' +endif + +runtime! syntax/css.vim +runtime! syntax/css/*.vim + +syn case ignore + +syn region hssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,hssDefinition,hssComment,hssIdChar,hssClassChar,hssAmpersand,hssVariable,hssInclude,hssExtend,hssDebug,hssWarn,@hssControl,hssInterpolation,hssNestedSelector,hssReturn + +syn region hssInterpolation start="#{" end="}" contains=hssVariable + +syn match hssVariable "$[[:alnum:]_-]\+" nextgroup=hssVariableAssignment +syn match hssVariableAssignment ":" contained nextgroup=hssVariableValue +syn match hssVariableValue ".*;"me=e-1 contained contains=hssVariable,hssOperator,hssDefault "me=e-1 means that the last char of the pattern is not highlighted +" syn match hssMixin "^@mixin" nextgroup=hssMixinName +syn match hssMixinName " [[:alnum:]_-]\+" contained nextgroup=hssDefinition +syn match hssFunction "^@function" nextgroup=hssFunctionName +syn match hssFunctionName " [[:alnum:]_-]\+" contained nextgroup=hssDefinition +" syn match hssReturn "@return" contained +" syn match hssInclude "@include" nextgroup=hssMixinName +" syn match hssExtend "@extend .*[;}]"me=e-1 contains=cssTagName,hssIdChar,hssClassChar +syn keyword hssTodo TODO FIXME NOTE OPTIMIZE XXX contained containedIn=hssComment,cssComment + +syn match hssColor "#[0-9A-Fa-f]\{3\}\>" contained +syn match hssColor "#[0-9A-Fa-f]\{6\}\>" contained + +syn match hssIdChar "#[[:alnum:]_-]\@=" nextgroup=hssId contains=hssColor +syn match hssId "[[:alnum:]_-]\+" contained +syn match hssClassChar "\.[[:alnum:]_-]\@=" nextgroup=hssClass +syn match hssClass "[[:alnum:]_-]\+" contained +syn match hssAmpersand "&" nextgroup=cssPseudoClass + +syn match hssOperator "+" contained +syn match hssOperator "-" contained +syn match hssOperator "/" contained +syn match hssOperator "*" contained + +syn match hssNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,hssIdChar,hssClassChar,hssAmpersand,hssVariable,hssMixin,hssFunction,@hssControl,hssInterpolation,hssNestedProperty +syn match hssNestedProperty "[[:alnum:]]\+:"me=e-1 contained + +" syn match hssDebug "@debug" +" syn match hssWarn "@warn" +syn match hssDefault "!default" contained + +" syn match hssIf "@if" +" syn match hssElse "@else" +" syn match hssElseIf "@else if" +" syn match hssWhile "@while" +" syn match hssFor "@for" nextgroup=hssVariable +" syn match hssFrom " from " +" syn match hssTo " to " +" syn match hssThrough " through " +" syn match hssEach "@each" nextgroup=hssVariable +" syn match hssIn " in " +" syn cluster hssControl contains=hssIf,hssElse,hssElseIf,hssWhile,hssFor,hssFrom,hssTo,hssThrough,hssEach,hssIn + +syn match hssComment "//.*$" contains=@Spell +syn region hssImportStr start="\"" end="\"" +syn region hssImport start="@import" end=";" contains=hssImportStr,hssComment,cssComment,cssUnicodeEscape,cssMediaType + +hi def link hssVariable Identifier +hi def link hssVariableValue Constant +hi def link hssMixin PreProc +hi def link hssMixinName Function +hi def link hssFunction PreProc +hi def link hssFunctionName Function +hi def link hssReturn Statement +hi def link hssInclude PreProc +hi def link hssExtend PreProc +hi def link hssComment Comment +hi def link hssColor Constant +hi def link hssIdChar Special +hi def link hssClassChar Special +hi def link hssId Identifier +hi def link hssClass Identifier +hi def link hssAmpersand Character +hi def link hssNestedProperty Type +hi def link hssDebug Debug +hi def link hssWarn Debug +hi def link hssDefault Special +hi def link hssIf Conditional +hi def link hssElse Conditional +hi def link hssElseIf Conditional +hi def link hssWhile Repeat +hi def link hssFor Repeat +hi def link hssFrom Repeat +hi def link hssTo Repeat +hi def link hssThrough Repeat +hi def link hssEach Repeat +hi def link hssIn Repeat +hi def link hssInterpolation Delimiter +hi def link hssImport Include +hi def link hssImportStr Include +hi def link hssTodo Todo + +let b:current_syntax = "hss" +if main_syntax == 'hss' + unlet main_syntax +endif diff --git a/syntax/hxml.vim b/syntax/hxml.vim new file mode 100644 index 00000000..f2416aad --- /dev/null +++ b/syntax/hxml.vim @@ -0,0 +1,90 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'haxe', 'syntax/hxml.vim') + finish +endif + +" Vim syntax file +" Author : Justin Donaldson (jdonaldson@gmail.com) +" Based extensively on a version by Ganesh Gunasegaran(me at itsgg.com) +" Language : hxml + +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax='hxml' +endif + +" Simple TODO/comment handling +syntax keyword hxmlTodo contained TODO FIXME XXX NOTE +syntax match hxmlComment "#.*$" contains=hxmlTodo + +" basic flags +syntax match hxmlType "-v" +syntax match hxmlType "-x" +syntax match hxmlType "-D" + +"target/config flags +syntax match hxmlType "--\?as3" +syntax match hxmlType "--\?cmd" +syntax match hxmlType "--\?cp" +syntax match hxmlType "--\?cpp" +syntax match hxmlType "--\?cppia" +syntax match hxmlType "--\?java" +syntax match hxmlType "--\?cs" +syntax match hxmlType "--\?debug" +syntax match hxmlType "--\?help" +syntax match hxmlType "--\?js" +syntax match hxmlType "--\?lib" +syntax match hxmlType "--\?lua" +syntax match hxmlType "--\?main" +syntax match hxmlType "--\?neko" +syntax match hxmlType "--\?php" +syntax match hxmlType "--\?python" +syntax match hxmlType "--\?prompt" +syntax match hxmlType "--\?resource" +syntax match hxmlType "--\?swf" +syntax match hxmlType "--\?swf-header" +syntax match hxmlType "--\?swf-lib" +syntax match hxmlType "--\?swf-version" +syntax match hxmlType "--\?swf9" +syntax match hxmlType "--\?xml" + +" haxe 3.0 flags +syntax match hxmlType "--/?dce" +syntax match hxmlType "--/?swf-lib-extern" +syntax match hxmlType "--/?version" +syntax match hxmlType "--/?help-metas" +syntax match hxmlType "--/?help-defines" + +" advanced flags +syntax match hxmlStatement "--connect" +syntax match hxmlStatement "--cwd" +syntax match hxmlStatement "--dead-code-elimination" +syntax match hxmlStatement "--display" +syntax match hxmlStatement "--flash-strict" +syntax match hxmlStatement "--flash-use-stage" +syntax match hxmlStatement "--gen-hx-classes" +syntax match hxmlStatement "--help" +syntax match hxmlStatement "--interp" +syntax match hxmlStatement "--js-modern" +syntax match hxmlStatement "--macro" +syntax match hxmlStatement "--next" +syntax match hxmlStatement "--no-inline" +syntax match hxmlStatement "--no-opt" +syntax match hxmlStatement "--no-output" +syntax match hxmlStatement "--no-traces" +syntax match hxmlStatement "--php-front" +syntax match hxmlStatement "--php-lib" +syntax match hxmlStatement "--php-prefix" +syntax match hxmlStatement "--remap" +syntax match hxmlStatement "--times" +syntax match hxmlStatement "--wait" + + +" Highlight them +highlight link hxmlType Type +highlight link hxmlStatement Statement +highlight link hxmlComment Comment +highlight link hxmlTodo Todo diff --git a/tests/filetypes.vim b/tests/filetypes.vim index fbcc3cf9..895ece5e 100644 --- a/tests/filetypes.vim +++ b/tests/filetypes.vim @@ -117,6 +117,8 @@ call TestFiletype('html.handlebars') call TestFiletype('haproxy') call TestFiletype('haskell') call TestFiletype('haxe') +call TestFiletype('hxml') +call TestFiletype('hss') call TestFiletype('hcl') call TestFiletype('hive') call TestFiletype('i3config') |