blob: ffa7820fe8e5b748e21dac387db833b79bd15aaa [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Smalltalk
3" Maintainer: Arndt Hesse <hesse@self.de>
Bram Moolenaar5dc62522012-02-13 00:05:22 +01004" Last Change: 2012 Feb 12 by Thilo Six
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02006" quit when a syntax file was already loaded
7if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00008 finish
9endif
10
Bram Moolenaar5dc62522012-02-13 00:05:22 +010011let s:cpo_save = &cpo
12set cpo&vim
13
Bram Moolenaar071d4272004-06-13 20:20:40 +000014" 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
Bram Moolenaar6c391a72021-09-09 21:55:11 +020047" the symbols prefixed by a '#'
Bram Moolenaar071d4272004-06-13 20:20:40 +000048syn 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
Bram Moolenaar6c391a72021-09-09 21:55:11 +020061" a try to highlight paren mismatches
Bram Moolenaar071d4272004-06-13 20:20:40 +000062syn 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.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020077" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
Bram Moolenaarf37506f2016-08-31 22:22:10 +020079hi 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000090
Bram Moolenaar071d4272004-06-13 20:20:40 +000091
92let b:current_syntax = "st"
Bram Moolenaar5dc62522012-02-13 00:05:22 +010093
94let &cpo = s:cpo_save
95unlet s:cpo_save