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