1" Vim syntax file 2" Language: Smalltalk 3" Maintainer: Arndt Hesse <[email protected]> 4" Last Change: 2012 Feb 12 by Thilo Six 5 6" For version 5.x: Clear all syntax items 7" For version 6.x: Quit when a syntax file was already loaded 8if version < 600 9 syntax clear 10elseif exists("b:current_syntax") 11 finish 12endif 13 14let s:cpo_save = &cpo 15set cpo&vim 16 17" some Smalltalk keywords and standard methods 18syn keyword stKeyword super self class true false new not 19syn keyword stKeyword notNil isNil inspect out nil 20syn match stMethod "\<do\>:" 21syn match stMethod "\<whileTrue\>:" 22syn match stMethod "\<whileFalse\>:" 23syn match stMethod "\<ifTrue\>:" 24syn match stMethod "\<ifFalse\>:" 25syn match stMethod "\<put\>:" 26syn match stMethod "\<to\>:" 27syn match stMethod "\<at\>:" 28syn match stMethod "\<add\>:" 29syn match stMethod "\<new\>:" 30syn match stMethod "\<for\>:" 31syn match stMethod "\<methods\>:" 32syn match stMethod "\<methodsFor\>:" 33syn match stMethod "\<instanceVariableNames\>:" 34syn match stMethod "\<classVariableNames\>:" 35syn match stMethod "\<poolDictionaries\>:" 36syn match stMethod "\<subclass\>:" 37 38" the block of local variables of a method 39syn region stLocalVariables start="^[ \t]*|" end="|" 40 41" the Smalltalk comment 42syn region stComment start="\"" end="\"" 43 44" the Smalltalk strings and single characters 45syn region stString start='\'' skip="''" end='\'' 46syn match stCharacter "$." 47 48syn case ignore 49 50" the symols prefixed by a '#' 51syn match stSymbol "\(#\<[a-z_][a-z0-9_]*\>\)" 52syn match stSymbol "\(#'[^']*'\)" 53 54" the variables in a statement block for loops 55syn match stBlockVariable "\(:[ \t]*\<[a-z_][a-z0-9_]*\>[ \t]*\)\+|" contained 56 57" some representations of numbers 58syn match stNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" 59syn match stFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" 60syn match stFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" 61 62syn case match 63 64" a try to higlight paren mismatches 65syn region stParen transparent start='(' end=')' contains=ALLBUT,stParenError 66syn match stParenError ")" 67syn region stBlock transparent start='\[' end='\]' contains=ALLBUT,stBlockError 68syn match stBlockError "\]" 69syn region stSet transparent start='{' end='}' contains=ALLBUT,stSetError 70syn match stSetError "}" 71 72hi link stParenError stError 73hi link stSetError stError 74hi link stBlockError stError 75 76" synchronization for syntax analysis 77syn sync minlines=50 78 79" Define the default highlighting. 80" For version 5.7 and earlier: only when not done already 81" For version 5.8 and later: only when an item doesn't have highlighting yet 82if version >= 508 || !exists("did_st_syntax_inits") 83 if version < 508 84 let did_st_syntax_inits = 1 85 command -nargs=+ HiLink hi link <args> 86 else 87 command -nargs=+ HiLink hi def link <args> 88 endif 89 90 HiLink stKeyword Statement 91 HiLink stMethod Statement 92 HiLink stComment Comment 93 HiLink stCharacter Constant 94 HiLink stString Constant 95 HiLink stSymbol Special 96 HiLink stNumber Type 97 HiLink stFloat Type 98 HiLink stError Error 99 HiLink stLocalVariables Identifier 100 HiLink stBlockVariable Identifier 101 102 delcommand HiLink 103endif 104 105let b:current_syntax = "st" 106 107let &cpo = s:cpo_save 108unlet s:cpo_save 109