7
|
1 " Vim syntax file
|
|
2 " Language: Smalltalk
|
|
3 " Maintainer: Arndt Hesse <hesse@self.de>
|
3356
|
4 " Last Change: 2012 Feb 12 by Thilo Six
|
7
|
5
|
|
6 " For version 5.x: Clear all syntax items
|
|
7 " For version 6.x: Quit when a syntax file was already loaded
|
|
8 if version < 600
|
|
9 syntax clear
|
|
10 elseif exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
3356
|
14 let s:cpo_save = &cpo
|
|
15 set cpo&vim
|
|
16
|
7
|
17 " some Smalltalk keywords and standard methods
|
|
18 syn keyword stKeyword super self class true false new not
|
|
19 syn keyword stKeyword notNil isNil inspect out nil
|
|
20 syn match stMethod "\<do\>:"
|
|
21 syn match stMethod "\<whileTrue\>:"
|
|
22 syn match stMethod "\<whileFalse\>:"
|
|
23 syn match stMethod "\<ifTrue\>:"
|
|
24 syn match stMethod "\<ifFalse\>:"
|
|
25 syn match stMethod "\<put\>:"
|
|
26 syn match stMethod "\<to\>:"
|
|
27 syn match stMethod "\<at\>:"
|
|
28 syn match stMethod "\<add\>:"
|
|
29 syn match stMethod "\<new\>:"
|
|
30 syn match stMethod "\<for\>:"
|
|
31 syn match stMethod "\<methods\>:"
|
|
32 syn match stMethod "\<methodsFor\>:"
|
|
33 syn match stMethod "\<instanceVariableNames\>:"
|
|
34 syn match stMethod "\<classVariableNames\>:"
|
|
35 syn match stMethod "\<poolDictionaries\>:"
|
|
36 syn match stMethod "\<subclass\>:"
|
|
37
|
|
38 " the block of local variables of a method
|
|
39 syn region stLocalVariables start="^[ \t]*|" end="|"
|
|
40
|
|
41 " the Smalltalk comment
|
|
42 syn region stComment start="\"" end="\""
|
|
43
|
|
44 " the Smalltalk strings and single characters
|
|
45 syn region stString start='\'' skip="''" end='\''
|
|
46 syn match stCharacter "$."
|
|
47
|
|
48 syn case ignore
|
|
49
|
|
50 " the symols prefixed by a '#'
|
|
51 syn match stSymbol "\(#\<[a-z_][a-z0-9_]*\>\)"
|
|
52 syn match stSymbol "\(#'[^']*'\)"
|
|
53
|
|
54 " the variables in a statement block for loops
|
|
55 syn match stBlockVariable "\(:[ \t]*\<[a-z_][a-z0-9_]*\>[ \t]*\)\+|" contained
|
|
56
|
|
57 " some representations of numbers
|
|
58 syn match stNumber "\<\d\+\(u\=l\=\|lu\|f\)\>"
|
|
59 syn match stFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
|
|
60 syn match stFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"
|
|
61
|
|
62 syn case match
|
|
63
|
|
64 " a try to higlight paren mismatches
|
|
65 syn region stParen transparent start='(' end=')' contains=ALLBUT,stParenError
|
|
66 syn match stParenError ")"
|
|
67 syn region stBlock transparent start='\[' end='\]' contains=ALLBUT,stBlockError
|
|
68 syn match stBlockError "\]"
|
|
69 syn region stSet transparent start='{' end='}' contains=ALLBUT,stSetError
|
|
70 syn match stSetError "}"
|
|
71
|
|
72 hi link stParenError stError
|
|
73 hi link stSetError stError
|
|
74 hi link stBlockError stError
|
|
75
|
|
76 " synchronization for syntax analysis
|
|
77 syn 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
|
|
82 if 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
|
|
103 endif
|
|
104
|
|
105 let b:current_syntax = "st"
|
3356
|
106
|
|
107 let &cpo = s:cpo_save
|
|
108 unlet s:cpo_save
|