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