home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / ocaml.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  3.0 KB  |  112 lines

  1. " Vim syntax file
  2. " Language:   OCAML
  3. " Maintainers:   Karl-Heinz Sylla <Karl-Heinz.Sylla>@gmd.de
  4. " Last change:   1998 August 26 adding ocaml 2.00 keywords
  5. "
  6.  
  7. " Remove any old syntax stuff hanging around.
  8. syn clear
  9.  
  10. " ocaml is case sensitive.
  11. syn case match
  12.  
  13. " It respects ocaml strings and constructors
  14.  
  15. syn region   ocamlComment start=+(\*+ end=+\*)+ contains=ocamlComment
  16. syn match    ocamlCommentError +\*)+
  17.  
  18. syn keyword  ocamlKeyword    and as asr begin class closed
  19. syn keyword  ocamlKeyword    constraint do done downto else end and
  20. syn keyword  ocamlKeyword    exception external for fun function
  21. syn keyword  ocamlKeyword    functor if in include inherit initializer
  22. syn keyword  ocamlKeyword    land let lor lsl lsr lxor match
  23. syn keyword  ocamlKeyword    method mod module mutable new object of
  24. syn keyword  ocamlKeyword    open or parser private rec sig
  25. syn keyword  ocamlKeyword    struct then to try type
  26. syn keyword  ocamlKeyword    unit val virtual when while with
  27.  
  28. syn keyword  ocamlType    int char string float bool exn
  29. syn keyword  ocamlType    list array option format
  30. syn match    ocamlType    +()+
  31.  
  32. syn keyword  ocamlBoolean    true false
  33.  
  34. syn keyword  ocamlKeyword    not
  35.  
  36. syn match    ocamlConstructor /\<[A-Z][0-9A-Za-z_]*\>/
  37. syn match    ocamlCharacter    +'.'\|'\\[0-9][0-9][0-9]'\|'\\[\'ntbr]'+
  38. syn match    ocamlCharErr    +'\\[0-9][0-9]'\|'\\[0-9]'+
  39. syn match    ocamlCharErr    +'\\[0-9][0-9]'\|'\\[0-9]'+
  40. syn match    ocamlCharErr    +'\\[^\'ntbr]'+
  41. syn region   ocamlString    start=+"+ skip=+\\"+ end=+"+
  42.  
  43. syn match    ocamlFunDef    "->"
  44. syn match    ocamlArray    "\[|\||\]"
  45. syn match    ocamlList    "\[\|\]"
  46. syn match    ocamlRefAssign    ":="
  47. syn match    ocamlTopStop    ";;"
  48. syn match    ocamlOperator    "\^"
  49. syn match    ocamlOperator    "::"
  50. syn match    ocamlOperator    "<-"
  51. syn match    ocamlAnyVar    +\<_\>+
  52. syn match    ocamlKeyChar    "!"
  53. syn match    ocamlKeyChar    "|"
  54. syn match    ocamlKeyChar    ";"
  55. syn match    ocamlKeyChar    "?"
  56. syn match    ocamlKeyChar    "\*"
  57. syn match    ocamlKeyChar    "="
  58.  
  59. syn match    ocamlModQualifier /\<[A-Z][0-9A-Za-z_]*\>[\b]*\./
  60.  
  61. "if !exists("ocaml_highlighting_clean")
  62.  
  63.   " some keywords
  64.   " some common functions are also highlighted as keywords
  65.   " is there a better solution?
  66.   syn keyword ocamlKeyword    trace
  67.  
  68.   syn match   ocamlNumber    "\<[0123456789]*\>"
  69.  
  70. "endif
  71.  
  72. syn sync ccomment maxlines=50
  73.  
  74. if !exists("did_ocaml_syntax_inits")
  75.  
  76.   let did_ocaml_syntax_inits = 1
  77.  
  78.   " The default methods for highlighting.  Can be overridden later
  79.  
  80.   hi link ocamlComment    Comment
  81.  
  82.   hi link ocamlModQualifier    Keyword
  83.  
  84.   hi link ocamlEnvKeyword    Keyword
  85.   hi link ocamlKeyword    Keyword
  86.   hi link ocamlFunDef    Keyword
  87.   hi link ocamlRefAssign    Keyword
  88.   hi link ocamlKeyChar    Keyword
  89.   hi link ocamlAnyVar    Keyword
  90.   hi link ocamlArray    Keyword
  91.   hi link ocamlList    Keyword
  92.   hi link ocamlTopStop    Keyword
  93.   hi link ocamlOperator    Keyword
  94.  
  95.   hi link ocamlConstructor    Constant
  96.  
  97.   hi link ocamlBoolean    Boolean
  98.   hi link ocamlCharacter    Character
  99.   hi link ocamlNumber    Number
  100.   hi link ocamlString    String
  101.  
  102.   hi link ocamlType    Type
  103.  
  104.   hi link ocamlCommentError    Error
  105.   hi link ocamlCharCodeErr    Error
  106.  
  107. endif
  108.  
  109. let b:current_syntax = "ocaml"
  110.  
  111. " vim: ts=28
  112.