xref: /vim-8.2.3635/runtime/syntax/modula2.vim (revision f37506f6)
1071d4279SBram Moolenaar" Vim syntax file
2071d4279SBram Moolenaar" Language:	Modula 2
3071d4279SBram Moolenaar" Maintainer:	[email protected] (Peter Funk)
4071d4279SBram Moolenaar"   based on original work of Bram Moolenaar <[email protected]>
5071d4279SBram Moolenaar" Last Change:	2001 May 09
6071d4279SBram Moolenaar
789bcfda6SBram Moolenaar" quit when a syntax file was already loaded
889bcfda6SBram Moolenaarif exists("b:current_syntax")
9071d4279SBram Moolenaar  finish
10071d4279SBram Moolenaarendif
11071d4279SBram Moolenaar
12071d4279SBram Moolenaar" Don't ignore case (Modula-2 is case significant). This is the default in vim
13071d4279SBram Moolenaar
14071d4279SBram Moolenaar" Especially emphasize headers of procedures and modules:
15071d4279SBram Moolenaarsyn region modula2Header matchgroup=modula2Header start="PROCEDURE " end="(" contains=modula2Ident oneline
16071d4279SBram Moolenaarsyn region modula2Header matchgroup=modula2Header start="MODULE " end=";" contains=modula2Ident oneline
17071d4279SBram Moolenaarsyn region modula2Header matchgroup=modula2Header start="BEGIN (\*" end="\*)" contains=modula2Ident oneline
18071d4279SBram Moolenaarsyn region modula2Header matchgroup=modula2Header start="END " end=";" contains=modula2Ident oneline
19071d4279SBram Moolenaarsyn region modula2Keyword start="END" end=";" contains=ALLBUT,modula2Ident oneline
20071d4279SBram Moolenaar
21071d4279SBram Moolenaar" Some very important keywords which should be emphasized more than others:
22071d4279SBram Moolenaarsyn keyword modula2AttKeyword CONST EXIT HALT RETURN TYPE VAR
23071d4279SBram Moolenaar" All other keywords in alphabetical order:
24071d4279SBram Moolenaarsyn keyword modula2Keyword AND ARRAY BY CASE DEFINITION DIV DO ELSE
25071d4279SBram Moolenaarsyn keyword modula2Keyword ELSIF EXPORT FOR FROM IF IMPLEMENTATION IMPORT
26071d4279SBram Moolenaarsyn keyword modula2Keyword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD
27071d4279SBram Moolenaarsyn keyword modula2Keyword SET THEN TO UNTIL WHILE WITH
28071d4279SBram Moolenaar
29071d4279SBram Moolenaarsyn keyword modula2Type ADDRESS BITSET BOOLEAN CARDINAL CHAR INTEGER REAL WORD
30071d4279SBram Moolenaarsyn keyword modula2StdFunc ABS CAP CHR DEC EXCL INC INCL ORD SIZE TSIZE VAL
31071d4279SBram Moolenaarsyn keyword modula2StdConst FALSE NIL TRUE
32071d4279SBram Moolenaar" The following may be discussed, since NEW and DISPOSE are some kind of
33071d4279SBram Moolenaar" special builtin macro functions:
34071d4279SBram Moolenaarsyn keyword modula2StdFunc NEW DISPOSE
35071d4279SBram Moolenaar" The following types are added later on and may be missing from older
36071d4279SBram Moolenaar" Modula-2 Compilers (they are at least missing from the original report
37071d4279SBram Moolenaar" by N.Wirth from March 1980 ;-)  Highlighting should apply nevertheless:
38071d4279SBram Moolenaarsyn keyword modula2Type BYTE LONGCARD LONGINT LONGREAL PROC SHORTCARD SHORTINT
39071d4279SBram Moolenaar" same note applies to min and max, which were also added later to m2:
40071d4279SBram Moolenaarsyn keyword modula2StdFunc MAX MIN
41071d4279SBram Moolenaar" The underscore was originally disallowed in m2 ids, it was also added later:
42071d4279SBram Moolenaarsyn match   modula2Ident " [A-Z,a-z][A-Z,a-z,0-9,_]*" contained
43071d4279SBram Moolenaar
44071d4279SBram Moolenaar" Comments may be nested in Modula-2:
45071d4279SBram Moolenaarsyn region modula2Comment start="(\*" end="\*)" contains=modula2Comment,modula2Todo
46071d4279SBram Moolenaarsyn keyword modula2Todo	contained TODO FIXME XXX
47071d4279SBram Moolenaar
48071d4279SBram Moolenaar" Strings
49071d4279SBram Moolenaarsyn region modula2String start=+"+ end=+"+
50071d4279SBram Moolenaarsyn region modula2String start="'" end="'"
51071d4279SBram Moolenaarsyn region modula2Set start="{" end="}"
52071d4279SBram Moolenaar
53071d4279SBram Moolenaar" Define the default highlighting.
5489bcfda6SBram Moolenaar" Only when an item doesn't have highlighting yet
55071d4279SBram Moolenaar
56*f37506f6SBram Moolenaarhi def link modula2Ident		Identifier
57*f37506f6SBram Moolenaarhi def link modula2StdConst	Boolean
58*f37506f6SBram Moolenaarhi def link modula2Type		Identifier
59*f37506f6SBram Moolenaarhi def link modula2StdFunc		Identifier
60*f37506f6SBram Moolenaarhi def link modula2Header		Type
61*f37506f6SBram Moolenaarhi def link modula2Keyword		Statement
62*f37506f6SBram Moolenaarhi def link modula2AttKeyword	PreProc
63*f37506f6SBram Moolenaarhi def link modula2Comment		Comment
64071d4279SBram Moolenaar" The following is just a matter of taste (you want to try this instead):
65071d4279SBram Moolenaar" hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold
66*f37506f6SBram Moolenaarhi def link modula2Todo		Todo
67*f37506f6SBram Moolenaarhi def link modula2String		String
68*f37506f6SBram Moolenaarhi def link modula2Set		String
69071d4279SBram Moolenaar
70071d4279SBram Moolenaar
71071d4279SBram Moolenaarlet b:current_syntax = "modula2"
72071d4279SBram Moolenaar
73071d4279SBram Moolenaar" vim: ts=8
74