st.vim 2.7 KB

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