Mercurial > vim
annotate runtime/syntax/modula2.vim @ 22643:71b57779177d v8.2.1870
patch 8.2.1870: Vim9: no need to keep all script variables
Commit: https://github.com/vim/vim/commit/39ca4127a094d8aca6f77c01be4f3fea506d5cb7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 20 14:25:07 2020 +0200
patch 8.2.1870: Vim9: no need to keep all script variables
Problem: Vim9: no need to keep all script variables.
Solution: Only keep script variables when a function was defined that could
use them. Fix freeing static string on exit.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Oct 2020 14:30:04 +0200 |
parents | 46763b01cd9a |
children | ff27442e7851 |
rev | line source |
---|---|
7 | 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 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
7 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
8 if exists("b:current_syntax") |
7 | 9 finish |
10 endif | |
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: | |
15 syn region modula2Header matchgroup=modula2Header start="PROCEDURE " end="(" contains=modula2Ident oneline | |
16 syn region modula2Header matchgroup=modula2Header start="MODULE " end=";" contains=modula2Ident oneline | |
17 syn region modula2Header matchgroup=modula2Header start="BEGIN (\*" end="\*)" contains=modula2Ident oneline | |
18 syn region modula2Header matchgroup=modula2Header start="END " end=";" contains=modula2Ident oneline | |
19 syn region modula2Keyword start="END" end=";" contains=ALLBUT,modula2Ident oneline | |
20 | |
21 " Some very important keywords which should be emphasized more than others: | |
22 syn keyword modula2AttKeyword CONST EXIT HALT RETURN TYPE VAR | |
23 " All other keywords in alphabetical order: | |
24 syn keyword modula2Keyword AND ARRAY BY CASE DEFINITION DIV DO ELSE | |
25 syn keyword modula2Keyword ELSIF EXPORT FOR FROM IF IMPLEMENTATION IMPORT | |
26 syn keyword modula2Keyword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD | |
27 syn keyword modula2Keyword SET THEN TO UNTIL WHILE WITH | |
28 | |
29 syn keyword modula2Type ADDRESS BITSET BOOLEAN CARDINAL CHAR INTEGER REAL WORD | |
30 syn keyword modula2StdFunc ABS CAP CHR DEC EXCL INC INCL ORD SIZE TSIZE VAL | |
31 syn keyword modula2StdConst FALSE NIL TRUE | |
32 " The following may be discussed, since NEW and DISPOSE are some kind of | |
33 " special builtin macro functions: | |
34 syn 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: | |
38 syn keyword modula2Type BYTE LONGCARD LONGINT LONGREAL PROC SHORTCARD SHORTINT | |
39 " same note applies to min and max, which were also added later to m2: | |
40 syn keyword modula2StdFunc MAX MIN | |
41 " The underscore was originally disallowed in m2 ids, it was also added later: | |
42 syn match modula2Ident " [A-Z,a-z][A-Z,a-z,0-9,_]*" contained | |
43 | |
44 " Comments may be nested in Modula-2: | |
45 syn region modula2Comment start="(\*" end="\*)" contains=modula2Comment,modula2Todo | |
46 syn keyword modula2Todo contained TODO FIXME XXX | |
47 | |
48 " Strings | |
49 syn region modula2String start=+"+ end=+"+ | |
50 syn region modula2String start="'" end="'" | |
51 syn region modula2Set start="{" end="}" | |
52 | |
53 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
54 " Only when an item doesn't have highlighting yet |
7 | 55 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
56 hi def link modula2Ident Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
57 hi def link modula2StdConst Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
58 hi def link modula2Type Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
59 hi def link modula2StdFunc Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
60 hi def link modula2Header Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
61 hi def link modula2Keyword Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
62 hi def link modula2AttKeyword PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
63 hi def link modula2Comment Comment |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
64 " The following is just a matter of taste (you want to try this instead): |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
65 " hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
66 hi def link modula2Todo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
67 hi def link modula2String String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
68 hi def link modula2Set String |
7 | 69 |
70 | |
71 let b:current_syntax = "modula2" | |
72 | |
73 " vim: ts=8 |