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