modula2.vim 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. " Vim syntax file
  2. " Language: Modula 2
  3. " Maintainer: pf@artcom0.north.de (Peter Funk)
  4. " based on original work of Bram Moolenaar <Bram@vim.org>
  5. " Last Change: 2001 May 09
  6. " quit when a syntax file was already loaded
  7. if exists("b:current_syntax")
  8. finish
  9. endif
  10. " Don't ignore case (Modula-2 is case significant). This is the default in vim
  11. " Especially emphasize headers of procedures and modules:
  12. syn region modula2Header matchgroup=modula2Header start="PROCEDURE " end="(" contains=modula2Ident oneline
  13. syn region modula2Header matchgroup=modula2Header start="MODULE " end=";" contains=modula2Ident oneline
  14. syn region modula2Header matchgroup=modula2Header start="BEGIN (\*" end="\*)" contains=modula2Ident oneline
  15. syn region modula2Header matchgroup=modula2Header start="END " end=";" contains=modula2Ident oneline
  16. syn region modula2Keyword start="END" end=";" contains=ALLBUT,modula2Ident oneline
  17. " Some very important keywords which should be emphasized more than others:
  18. syn keyword modula2AttKeyword CONST EXIT HALT RETURN TYPE VAR
  19. " All other keywords in alphabetical order:
  20. syn keyword modula2Keyword AND ARRAY BY CASE DEFINITION DIV DO ELSE
  21. syn keyword modula2Keyword ELSIF EXPORT FOR FROM IF IMPLEMENTATION IMPORT
  22. syn keyword modula2Keyword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD
  23. syn keyword modula2Keyword SET THEN TO UNTIL WHILE WITH
  24. syn keyword modula2Type ADDRESS BITSET BOOLEAN CARDINAL CHAR INTEGER REAL WORD
  25. syn keyword modula2StdFunc ABS CAP CHR DEC EXCL INC INCL ORD SIZE TSIZE VAL
  26. syn keyword modula2StdConst FALSE NIL TRUE
  27. " The following may be discussed, since NEW and DISPOSE are some kind of
  28. " special builtin macro functions:
  29. syn keyword modula2StdFunc NEW DISPOSE
  30. " The following types are added later on and may be missing from older
  31. " Modula-2 Compilers (they are at least missing from the original report
  32. " by N.Wirth from March 1980 ;-) Highlighting should apply nevertheless:
  33. syn keyword modula2Type BYTE LONGCARD LONGINT LONGREAL PROC SHORTCARD SHORTINT
  34. " same note applies to min and max, which were also added later to m2:
  35. syn keyword modula2StdFunc MAX MIN
  36. " The underscore was originally disallowed in m2 ids, it was also added later:
  37. syn match modula2Ident " [A-Z,a-z][A-Z,a-z,0-9,_]*" contained
  38. " Comments may be nested in Modula-2:
  39. syn region modula2Comment start="(\*" end="\*)" contains=modula2Comment,modula2Todo
  40. syn keyword modula2Todo contained TODO FIXME XXX
  41. " Strings
  42. syn region modula2String start=+"+ end=+"+
  43. syn region modula2String start="'" end="'"
  44. syn region modula2Set start="{" end="}"
  45. " Define the default highlighting.
  46. " Only when an item doesn't have highlighting yet
  47. hi def link modula2Ident Identifier
  48. hi def link modula2StdConst Boolean
  49. hi def link modula2Type Identifier
  50. hi def link modula2StdFunc Identifier
  51. hi def link modula2Header Type
  52. hi def link modula2Keyword Statement
  53. hi def link modula2AttKeyword PreProc
  54. hi def link modula2Comment Comment
  55. " The following is just a matter of taste (you want to try this instead):
  56. " hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold
  57. hi def link modula2Todo Todo
  58. hi def link modula2String String
  59. hi def link modula2Set String
  60. let b:current_syntax = "modula2"
  61. " vim: ts=8