summaryrefslogtreecommitdiffstats
path: root/runtime/syntax
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2024-01-05 17:59:04 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-05 17:59:04 +0100
commit68a89470693c7687d4e736ca056c05de632e3ac7 (patch)
tree6b075cfda5ae9a9f125eaa9012bf0f90f1fc7112 /runtime/syntax
parent3779516988f14f2070d827514c79383334a0946b (diff)
patch 9.1.0013: Modula2 filetype support lackingv9.1.0013
Problem: Modula2 filetype support lacking Solution: Improve the Modula-2 runtime support, add additional modula2 dialects, add compiler plugin, update syntax highlighting, include syntax tests, update Makefiles (Doug Kearns) closes: #6796 closes: #8115 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Benjamin Kowarsch <trijezdci@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/modula2.vim71
-rw-r--r--runtime/syntax/modula2/opt/iso.vim380
-rw-r--r--runtime/syntax/modula2/opt/pim.vim377
-rw-r--r--runtime/syntax/modula2/opt/r10.vim452
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_03.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_04.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_05.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_06.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_iso_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_03.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_04.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_05.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_pim_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_03.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_04.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_05.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_06.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_07.dump20
-rw-r--r--runtime/syntax/testdir/dumps/modula2_r10_99.dump20
-rw-r--r--runtime/syntax/testdir/input/modula2_iso.def114
-rw-r--r--runtime/syntax/testdir/input/modula2_pim.def111
-rw-r--r--runtime/syntax/testdir/input/modula2_r10.def146
31 files changed, 2067 insertions, 64 deletions
diff --git a/runtime/syntax/modula2.vim b/runtime/syntax/modula2.vim
index 4a14cf1f6f..6a9f4af6aa 100644
--- a/runtime/syntax/modula2.vim
+++ b/runtime/syntax/modula2.vim
@@ -1,73 +1,16 @@
" Vim syntax file
-" Language: Modula 2
-" Maintainer: pf@artcom0.north.de (Peter Funk)
-" based on original work of Bram Moolenaar <Bram@vim.org>
-" Last Change: 2001 May 09
+" Language: Modula-2
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: pf@artcom0.north.de (Peter Funk)
+" Last Change: 2024 Jan 04
-" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
-" Don't ignore case (Modula-2 is case significant). This is the default in vim
-
-" Especially emphasize headers of procedures and modules:
-syn region modula2Header matchgroup=modula2Header start="PROCEDURE " end="(" contains=modula2Ident oneline
-syn region modula2Header matchgroup=modula2Header start="MODULE " end=";" contains=modula2Ident oneline
-syn region modula2Header matchgroup=modula2Header start="BEGIN (\*" end="\*)" contains=modula2Ident oneline
-syn region modula2Header matchgroup=modula2Header start="END " end=";" contains=modula2Ident oneline
-syn region modula2Keyword start="END" end=";" contains=ALLBUT,modula2Ident oneline
-
-" Some very important keywords which should be emphasized more than others:
-syn keyword modula2AttKeyword CONST EXIT HALT RETURN TYPE VAR
-" All other keywords in alphabetical order:
-syn keyword modula2Keyword AND ARRAY BY CASE DEFINITION DIV DO ELSE
-syn keyword modula2Keyword ELSIF EXPORT FOR FROM IF IMPLEMENTATION IMPORT
-syn keyword modula2Keyword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD
-syn keyword modula2Keyword SET THEN TO UNTIL WHILE WITH
-
-syn keyword modula2Type ADDRESS BITSET BOOLEAN CARDINAL CHAR INTEGER REAL WORD
-syn keyword modula2StdFunc ABS CAP CHR DEC EXCL INC INCL ORD SIZE TSIZE VAL
-syn keyword modula2StdConst FALSE NIL TRUE
-" The following may be discussed, since NEW and DISPOSE are some kind of
-" special builtin macro functions:
-syn keyword modula2StdFunc NEW DISPOSE
-" The following types are added later on and may be missing from older
-" Modula-2 Compilers (they are at least missing from the original report
-" by N.Wirth from March 1980 ;-) Highlighting should apply nevertheless:
-syn keyword modula2Type BYTE LONGCARD LONGINT LONGREAL PROC SHORTCARD SHORTINT
-" same note applies to min and max, which were also added later to m2:
-syn keyword modula2StdFunc MAX MIN
-" The underscore was originally disallowed in m2 ids, it was also added later:
-syn match modula2Ident " [A-Z,a-z][A-Z,a-z,0-9,_]*" contained
-
-" Comments may be nested in Modula-2:
-syn region modula2Comment start="(\*" end="\*)" contains=modula2Comment,modula2Todo
-syn keyword modula2Todo contained TODO FIXME XXX
-
-" Strings
-syn region modula2String start=+"+ end=+"+
-syn region modula2String start="'" end="'"
-syn region modula2Set start="{" end="}"
-
-" Define the default highlighting.
-" Only when an item doesn't have highlighting yet
-
-hi def link modula2Ident Identifier
-hi def link modula2StdConst Boolean
-hi def link modula2Type Identifier
-hi def link modula2StdFunc Identifier
-hi def link modula2Header Type
-hi def link modula2Keyword Statement
-hi def link modula2AttKeyword PreProc
-hi def link modula2Comment Comment
-" The following is just a matter of taste (you want to try this instead):
-" hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold
-hi def link modula2Todo Todo
-hi def link modula2String String
-hi def link modula2Set String
-
+let dialect = modula2#GetDialect()
+exe "runtime! syntax/modula2/opt/" .. dialect .. ".vim"
let b:current_syntax = "modula2"
-" vim: ts=8
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/syntax/modula2/opt/iso.vim b/runtime/syntax/modula2/opt/iso.vim
new file mode 100644
index 0000000000..5bd24f6885
--- /dev/null
+++ b/runtime/syntax/modula2/opt/iso.vim
@@ -0,0 +1,380 @@
+" Vim syntax file
+" Language: Modula-2 (ISO)
+" Maintainer: B.Kowarsch <trijezdci@moc.liamg>
+" Last Change: 2016 August 22
+
+" ----------------------------------------------------
+" THIS FILE IS LICENSED UNDER THE VIM LICENSE
+" see https://github.com/vim/vim/blob/master/LICENSE
+" ----------------------------------------------------
+
+" Remarks:
+" Vim Syntax files are available for the following Modula-2 dialects:
+" * for the PIM dialect : m2pim.vim
+" * for the ISO dialect : m2iso.vim (this file)
+" * for the R10 dialect : m2r10.vim
+
+" -----------------------------------------------------------------------------
+" This syntax description follows ISO standard IS-10514 (aka ISO Modula-2)
+" with the addition of the following language extensions:
+" * non-standard types LONGCARD and LONGBITSET
+" * non-nesting code disabling tags ?< and >? at the start of a line
+" -----------------------------------------------------------------------------
+
+" Parameters:
+"
+" Vim's filetype script recognises Modula-2 dialect tags within the first 200
+" lines of Modula-2 .def and .mod input files. The script sets filetype and
+" dialect automatically when a valid dialect tag is found in the input file.
+" The dialect tag for the ISO dialect is (*!m2iso*). It is recommended to put
+" the tag immediately after the module header in the Modula-2 input file.
+"
+" Example:
+" DEFINITION MODULE Foolib; (*!m2iso*)
+"
+" Variable g:modula2_default_dialect sets the default Modula-2 dialect when the
+" dialect cannot be determined from the contents of the Modula-2 input file:
+" if defined and set to 'm2iso', the default dialect is ISO.
+"
+" Variable g:modula2_iso_allow_lowline controls support for lowline in identifiers:
+" if defined and set to a non-zero value, they are recognised, otherwise not
+"
+" Variable g:modula2_iso_disallow_octals controls the rendering of octal literals:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variable g:modula2_iso_disallow_synonyms controls the rendering of @, & and ~:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variables may be defined in Vim startup file .vimrc
+"
+" Examples:
+" let g:modula2_default_dialect = 'm2iso'
+" let g:modula2_iso_allow_lowline = 1
+" let g:modula2_iso_disallow_octals = 1
+" let g:modula2_iso_disallow_synonyms = 1
+
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Modula-2 is case sensitive
+syn case match
+
+
+" -----------------------------------------------------------------------------
+" Reserved Words
+" -----------------------------------------------------------------------------
+syn keyword modula2Resword AND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE
+syn keyword modula2Resword ELSIF EXCEPT EXIT EXPORT FINALLY FOR FORWARD FROM IF
+syn keyword modula2Resword IMPLEMENTATION IMPORT IN LOOP MOD NOT OF OR PACKEDSET
+syn keyword modula2Resword POINTER QUALIFIED RECORD REPEAT REM RETRY RETURN SET
+syn keyword modula2Resword THEN TO TYPE UNTIL VAR WHILE WITH
+
+
+" -----------------------------------------------------------------------------
+" Builtin Constant Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ConstIdent FALSE NIL TRUE INTERRUPTIBLE UNINTERRUPTIBLE
+
+
+" -----------------------------------------------------------------------------
+" Builtin Type Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2TypeIdent BITSET BOOLEAN CHAR PROC
+syn keyword modula2TypeIdent CARDINAL INTEGER LONGINT REAL LONGREAL
+syn keyword modula2TypeIdent COMPLEX LONGCOMPLEX PROTECTION
+
+
+" -----------------------------------------------------------------------------
+" Builtin Procedure and Function Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ProcIdent CAP DEC EXCL HALT INC INCL
+syn keyword modula2FuncIdent ABS CHR CMPLX FLOAT HIGH IM INT LENGTH LFLOAT MAX MIN
+syn keyword modula2FuncIdent ODD ORD RE SIZE TRUNC VAL
+
+
+" -----------------------------------------------------------------------------
+" Wirthian Macro Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2MacroIdent NEW DISPOSE
+
+
+" -----------------------------------------------------------------------------
+" Unsafe Facilities via Pseudo-Module SYSTEM
+" -----------------------------------------------------------------------------
+syn keyword modula2UnsafeIdent ADDRESS BYTE LOC WORD
+syn keyword modula2UnsafeIdent ADR CAST TSIZE SYSTEM
+syn keyword modula2UnsafeIdent MAKEADR ADDADR SUBADR DIFADR ROTATE SHIFT
+
+
+" -----------------------------------------------------------------------------
+" Non-Portable Language Extensions
+" -----------------------------------------------------------------------------
+syn keyword modula2NonPortableIdent LONGCARD LONGBITSET
+
+
+" -----------------------------------------------------------------------------
+" User Defined Identifiers
+" -----------------------------------------------------------------------------
+syn match modula2Ident "[a-zA-Z][a-zA-Z0-9]*\(_\)\@!"
+syn match modula2LowLineIdent "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+"
+
+
+" -----------------------------------------------------------------------------
+" String Literals
+" -----------------------------------------------------------------------------
+syn region modula2String start=/"/ end=/"/ oneline
+syn region modula2String start=/'/ end=/'/ oneline
+
+
+" -----------------------------------------------------------------------------
+" Numeric Literals
+" -----------------------------------------------------------------------------
+syn match modula2Num
+ \ "\(\([0-7]\+\)[BC]\@!\|[89]\)[0-9]*\(\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?\)\?"
+syn match modula2Num "[0-9A-F]\+H"
+syn match modula2Octal "[0-7]\+[BC]"
+
+
+" -----------------------------------------------------------------------------
+" Punctuation
+" -----------------------------------------------------------------------------
+syn match modula2Punctuation
+ \ "\.\|[,:;]\|\*\|[/+-]\|\#\|[=<>]\|\^\|\[\|\]\|(\(\*\)\@!\|[){}]"
+syn match modula2Synonym "[@&~]"
+
+
+" -----------------------------------------------------------------------------
+" Pragmas
+" -----------------------------------------------------------------------------
+syn region modula2Pragma start="<\*" end="\*>"
+syn match modula2DialectTag "(\*!m2iso\(+[a-z0-9]\+\)\?\*)"
+
+" -----------------------------------------------------------------------------
+" Block Comments
+" -----------------------------------------------------------------------------
+syn region modula2Comment start="(\*\(!m2iso\(+[a-z0-9]\+\)\?\*)\)\@!" end="\*)"
+ \ contains = modula2Comment, modula2CommentKey, modula2TechDebtMarker
+syn match modula2CommentKey "[Aa]uthor[s]\?\|[Cc]opyright\|[Ll]icense\|[Ss]ynopsis"
+syn match modula2CommentKey "\([Pp]re\|[Pp]ost\|[Ee]rror\)\-condition[s]\?:"
+
+
+" -----------------------------------------------------------------------------
+" Technical Debt Markers
+" -----------------------------------------------------------------------------
+syn keyword modula2TechDebtMarker contained DEPRECATED FIXME
+syn match modula2TechDebtMarker "TODO[:]\?" contained
+
+" -----------------------------------------------------------------------------
+" Disabled Code Sections
+" -----------------------------------------------------------------------------
+syn region modula2DisabledCode start="^?<" end="^>?"
+
+
+" -----------------------------------------------------------------------------
+" Headers
+" -----------------------------------------------------------------------------
+" !!! this section must be second last !!!
+
+" new module header
+syn match modula2ModuleHeader
+ \ "MODULE\( [A-Z][a-zA-Z0-9]*\)\?"
+ \ contains = modula2ReswordModule, modula2ModuleIdent
+
+syn match modula2ModuleIdent
+ \ "[A-Z][a-zA-Z0-9]*" contained
+
+syn match modula2ModuleTail
+ \ "END [A-Z][a-zA-Z0-9]*\.$"
+ \ contains = modula2ReswordEnd, modula2ModuleIdent, modula2Punctuation
+
+" new procedure header
+syn match modula2ProcedureHeader
+ \ "PROCEDURE\( [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)\?"
+ \ contains = modula2ReswordProcedure,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+syn match modula2ProcedureIdent
+ \ "\([a-zA-Z]\)\([a-zA-Z0-9]*\)" contained
+
+syn match modula2ProcedureLowlineIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+" contained
+
+syn match modula2ProcedureTail
+ \ "END\( \([a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)[.;]$\)\?"
+ \ contains = modula2ReswordEnd,
+ \ modula2ProcedureIdent, modula2ProcedureLowLineIdent,
+ \ modula2Punctuation, modula2IllegalChar, modula2IllegalIdent
+
+syn keyword modula2ReswordModule contained MODULE
+syn keyword modula2ReswordProcedure contained PROCEDURE
+syn keyword modula2ReswordEnd contained END
+
+
+" -----------------------------------------------------------------------------
+" Illegal Symbols
+" -----------------------------------------------------------------------------
+" !!! this section must be last !!!
+
+" any '`' '!' '$' '%' or '\'
+syn match modula2IllegalChar "[`!$%\\]"
+
+" any solitary sequence of '_'
+syn match modula2IllegalChar "\<_\+\>"
+
+" any '?' at start of line if not followed by '<'
+syn match modula2IllegalChar "^?\(<\)\@!"
+
+" any '?' not following '>' at start of line
+syn match modula2IllegalChar "\(\(^>\)\|\(^\)\)\@<!?"
+
+" any identifiers with leading occurrences of '_'
+syn match modula2IllegalIdent "_\+[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]*\)*"
+
+" any identifiers containing consecutive occurences of '_'
+syn match modula2IllegalIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\(__\+[a-zA-Z0-9]\+\(_[a-zA-Z0-9]\+\)*\)\+"
+
+" any identifiers with trailing occurrences of '_'
+syn match modula2IllegalIdent "[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]\+\)*_\+\>"
+
+
+" -----------------------------------------------------------------------------
+" Define Rendering Styles
+" -----------------------------------------------------------------------------
+
+" highlight default link modula2PredefIdentStyle Keyword
+" highlight default link modula2ConstIdentStyle modula2PredefIdentStyle
+" highlight default link modula2TypeIdentStyle modula2PredefIdentStyle
+" highlight default link modula2ProcIdentStyle modula2PredefIdentStyle
+" highlight default link modula2FuncIdentStyle modula2PredefIdentStyle
+" highlight default link modula2MacroIdentStyle modula2PredefIdentStyle
+
+highlight default link modula2ConstIdentStyle Constant
+highlight default link modula2TypeIdentStyle Type
+highlight default link modula2ProcIdentStyle Function
+highlight default link modula2FuncIdentStyle Function
+highlight default link modula2MacroIdentStyle Function
+highlight default link modula2UnsafeIdentStyle Question
+highlight default link modula2NonPortableIdentStyle Question
+highlight default link modula2StringLiteralStyle String
+highlight default link modula2CommentStyle Comment
+highlight default link modula2PragmaStyle PreProc
+highlight default link modula2DialectTagStyle SpecialComment
+highlight default link modula2TechDebtMarkerStyle SpecialComment
+highlight default link modula2ReswordStyle Keyword
+highlight default link modula2HeaderIdentStyle Function
+highlight default link modula2UserDefIdentStyle Normal
+highlight default link modula2NumericLiteralStyle Number
+highlight default link modula2PunctuationStyle Delimiter
+highlight default link modula2CommentKeyStyle SpecialComment
+highlight default link modula2DisabledCodeStyle NonText
+
+" -----------------------------------------------------------------------------
+" Assign Rendering Styles
+" -----------------------------------------------------------------------------
+
+" headers
+highlight default link modula2ModuleIdent modula2HeaderIdentStyle
+highlight default link modula2ProcedureIdent modula2HeaderIdentStyle
+highlight default link modula2ModuleHeader Normal
+highlight default link modula2ModuleTail Normal
+highlight default link modula2ProcedureHeader Normal
+highlight default link modula2ProcedureTail Normal
+
+" lowline identifiers are rendered as errors if g:modula2_iso_allow_lowline is unset
+if exists("g:modula2_iso_allow_lowline")
+ if g:modula2_iso_allow_lowline != 0
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+ else
+ highlight default link modula2ProcedureLowlineIdent Error
+ endif
+else
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+endif
+
+" reserved words
+highlight default link modula2Resword modula2ReswordStyle
+highlight default link modula2ReswordModule modula2ReswordStyle
+highlight default link modula2ReswordProcedure modula2ReswordStyle
+highlight default link modula2ReswordEnd modula2ReswordStyle
+
+" predefined identifiers
+highlight default link modula2ConstIdent modula2ConstIdentStyle
+highlight default link modula2TypeIdent modula2TypeIdentStyle
+highlight default link modula2ProcIdent modula2ProcIdentStyle
+highlight default link modula2FuncIdent modula2FuncIdentStyle
+highlight default link modula2MacroIdent modula2MacroIdentStyle
+
+" unsafe and non-portable identifiers
+highlight default link modula2UnsafeIdent modula2UnsafeIdentStyle
+highlight default link modula2NonPortableIdent modula2NonPortableIdentStyle
+
+" user defined identifiers
+highlight default link modula2Ident modula2UserDefIdentStyle
+
+" lowline identifiers are rendered as errors if g:modula2_iso_allow_lowline is unset
+if exists("g:modula2_iso_allow_lowline")
+ if g:modula2_iso_allow_lowline != 0
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+ else
+ highlight default link modula2LowLineIdent Error
+ endif
+else
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+endif
+
+" literals
+highlight default link modula2String modula2StringLiteralStyle
+highlight default link modula2Num modula2NumericLiteralStyle
+
+" octal literals are rendered as errors if g:modula2_iso_disallow_octals is set
+if exists("g:modula2_iso_disallow_octals")
+ if g:modula2_iso_disallow_octals != 0
+ highlight default link modula2Octal Error
+ else
+ highlight default link modula2Octal modula2NumericLiteralStyle
+ endif
+else
+ highlight default link modula2Octal modula2NumericLiteralStyle
+endif
+
+" punctuation
+highlight default link modula2Punctuation modula2PunctuationStyle
+
+" synonyms & and ~ are rendered as errors if g:modula2_iso_disallow_synonyms is set
+if exists("g:modula2_iso_disallow_synonyms")
+ if g:modula2_iso_disallow_synonyms != 0
+ highlight default link modula2Synonym Error
+ else
+ highlight default link modula2Synonym modula2PunctuationStyle
+ endif
+else
+ highlight default link modula2Synonym modula2PunctuationStyle
+endif
+
+" pragmas
+highlight default link modula2Pragma modula2PragmaStyle
+highlight default link modula2DialectTag modula2DialectTagStyle
+
+" comments
+highlight default link modula2Comment modula2CommentStyle
+highlight default link modula2CommentKey modula2CommentKeyStyle
+
+" technical debt markers
+highlight default link modula2TechDebtMarker modula2TechDebtMarkerStyle
+
+" disabled code
+highlight default link modula2DisabledCode modula2DisabledCodeStyle
+
+" illegal symbols
+highlight default link modula2IllegalChar Error
+highlight default link modula2IllegalIdent Error
+
+
+let b:current_syntax = "modula2"
+
+" vim: ts=4
+
+" END OF FILE
diff --git a/runtime/syntax/modula2/opt/pim.vim b/runtime/syntax/modula2/opt/pim.vim
new file mode 100644
index 0000000000..1626db91cf
--- /dev/null
+++ b/runtime/syntax/modula2/opt/pim.vim
@@ -0,0 +1,377 @@
+" Vim syntax file
+" Language: Modula-2 (PIM)
+" Maintainer: B.Kowarsch <trijezdci@moc.liamg>
+" Last Change: 2016 August 22
+
+" ----------------------------------------------------
+" THIS FILE IS LICENSED UNDER THE VIM LICENSE
+" see https://github.com/vim/vim/blob/master/LICENSE
+" ----------------------------------------------------
+
+" Remarks:
+" Vim Syntax files are available for the following Modula-2 dialects:
+" * for the PIM dialect : m2pim.vim (this file)
+" * for the ISO dialect : m2iso.vim
+" * for the R10 dialect : m2r10.vim
+
+" -----------------------------------------------------------------------------
+" This syntax description follows the 3rd and 4th editions of N.Wirth's Book
+" Programming in Modula-2 (aka PIM) plus the following language extensions:
+" * non-leading, non-trailing, non-consecutive lowlines _ in identifiers
+" * widely supported non-standard types BYTE, LONGCARD and LONGBITSET
+" * non-nesting code disabling tags ?< and >? at the start of a line
+" -----------------------------------------------------------------------------
+
+" Parameters:
+"
+" Vim's filetype script recognises Modula-2 dialect tags within the first 200
+" lines of Modula-2 .def and .mod input files. The script sets filetype and
+" dialect automatically when a valid dialect tag is found in the input file.
+" The dialect tag for the PIM dialect is (*!m2pim*). It is recommended to put
+" the tag immediately after the module header in the Modula-2 input file.
+"
+" Example:
+" DEFINITION MODULE Foolib; (*!m2pim*)
+"
+" Variable g:modula2_default_dialect sets the default Modula-2 dialect when the
+" dialect cannot be determined from the contents of the Modula-2 input file:
+" if defined and set to 'm2pim', the default dialect is PIM.
+"
+" Variable g:modula2_pim_allow_lowline controls support for lowline in identifiers:
+" if defined and set to a non-zero value, they are recognised, otherwise not
+"
+" Variable g:modula2_pim_disallow_octals controls the rendering of octal literals:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variable g:modula2_pim_disallow_synonyms controls the rendering of & and ~:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variables may be defined in Vim startup file .vimrc
+"
+" Examples:
+" let g:modula2_default_dialect = 'm2pim'
+" let g:modula2_pim_allow_lowline = 1
+" let g:modula2_pim_disallow_octals = 1
+" let g:modula2_pim_disallow_synonyms = 1
+
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Modula-2 is case sensitive
+syn case match
+
+
+" -----------------------------------------------------------------------------
+" Reserved Words
+" -----------------------------------------------------------------------------
+syn keyword modula2Resword AND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE
+syn keyword modula2Resword ELSIF EXIT EXPORT FOR FROM IF IMPLEMENTATION IMPORT
+syn keyword modula2Resword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD REPEAT
+syn keyword modula2Resword RETURN SET THEN TO TYPE UNTIL VAR WHILE WITH
+
+
+" -----------------------------------------------------------------------------
+" Builtin Constant Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ConstIdent FALSE NIL TRUE
+
+
+" -----------------------------------------------------------------------------
+" Builtin Type Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2TypeIdent BITSET BOOLEAN CHAR PROC
+syn keyword modula2TypeIdent CARDINAL INTEGER LONGINT REAL LONGREAL
+
+
+" -----------------------------------------------------------------------------
+" Builtin Procedure and Function Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ProcIdent CAP DEC EXCL HALT INC INCL
+syn keyword modula2FuncIdent ABS CHR FLOAT HIGH MAX MIN ODD ORD SIZE TRUNC VAL
+
+
+" -----------------------------------------------------------------------------
+" Wirthian Macro Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2MacroIdent NEW DISPOSE
+
+
+" -----------------------------------------------------------------------------
+" Unsafe Facilities via Pseudo-Module SYSTEM
+" -----------------------------------------------------------------------------
+syn keyword modula2UnsafeIdent ADDRESS PROCESS WORD
+syn keyword modula2UnsafeIdent ADR TSIZE NEWPROCESS TRANSFER SYSTEM
+
+
+" -----------------------------------------------------------------------------
+" Non-Portable Language Extensions
+" -----------------------------------------------------------------------------
+syn keyword modula2NonPortableIdent BYTE LONGCARD LONGBITSET
+
+
+" -----------------------------------------------------------------------------
+" User Defined Identifiers
+" -----------------------------------------------------------------------------
+syn match modula2Ident "[a-zA-Z][a-zA-Z0-9]*\(_\)\@!"
+syn match modula2LowLineIdent "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+"
+
+
+" -----------------------------------------------------------------------------
+" String Literals
+" -----------------------------------------------------------------------------
+syn region modula2String start=/"/ end=/"/ oneline
+syn region modula2String start=/'/ end=/'/ oneline
+
+
+" -----------------------------------------------------------------------------
+" Numeric Literals
+" -----------------------------------------------------------------------------
+syn match modula2Num
+ \ "\(\([0-7]\+\)[BC]\@!\|[89]\)[0-9]*\(\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?\)\?"
+syn match modula2Num "[0-9A-F]\+H"
+syn match modula2Octal "[0-7]\+[BC]"
+
+
+" -----------------------------------------------------------------------------
+" Punctuation
+" -----------------------------------------------------------------------------
+syn match modula2Punctuation
+ \ "\.\|[,:;]\|\*\|[/+-]\|\#\|[=<>]\|\^\|\[\|\]\|(\(\*\)\@!\|[){}]"
+syn match modula2Synonym "[&~]"
+
+
+" -----------------------------------------------------------------------------
+" Pragmas
+" -----------------------------------------------------------------------------
+syn region modula2Pragma start="(\*\$" end="\*)"
+syn match modula2DialectTag "(\*!m2pim\(+[a-z0-9]\+\)\?\*)"
+
+" -----------------------------------------------------------------------------
+" Block Comments
+" -----------------------------------------------------------------------------
+syn region modula2Comment start="(\*\(\$\|!m2pim\(+[a-z0-9]\+\)\?\*)\)\@!" end="\*)"
+ \ contains = modula2Comment, modula2CommentKey, modula2TechDebtMarker
+syn match modula2CommentKey "[Aa]uthor[s]\?\|[Cc]opyright\|[Ll]icense\|[Ss]ynopsis"
+syn match modula2CommentKey "\([Pp]re\|[Pp]ost\|[Ee]rror\)\-condition[s]\?:"
+
+
+" -----------------------------------------------------------------------------
+" Technical Debt Markers
+" -----------------------------------------------------------------------------
+syn keyword modula2TechDebtMarker contained DEPRECATED FIXME
+syn match modula2TechDebtMarker "TODO[:]\?" contained
+
+" -----------------------------------------------------------------------------
+" Disabled Code Sections
+" -----------------------------------------------------------------------------
+syn region modula2DisabledCode start="^?<" end="^>?"
+
+
+" -----------------------------------------------------------------------------
+" Headers
+" -----------------------------------------------------------------------------
+" !!! this section must be second last !!!
+
+" new module header
+syn match modula2ModuleHeader
+ \ "MODULE\( [A-Z][a-zA-Z0-9]*\)\?"
+ \ contains = modula2ReswordModule, modula2ModuleIdent
+
+syn match modula2ModuleIdent
+ \ "[A-Z][a-zA-Z0-9]*" contained
+
+syn match modula2ModuleTail
+ \ "END [A-Z][a-zA-Z0-9]*\.$"
+ \ contains = modula2ReswordEnd, modula2ModuleIdent, modula2Punctuation
+
+" new procedure header
+syn match modula2ProcedureHeader
+ \ "PROCEDURE\( [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)\?"
+ \ contains = modula2ReswordProcedure,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+syn match modula2ProcedureIdent
+ \ "\([a-zA-Z]\)\([a-zA-Z0-9]*\)" contained
+
+syn match modula2ProcedureLowlineIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+" contained
+
+syn match modula2ProcedureTail
+ \ "END\( \([a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)[.;]$\)\?"
+ \ contains = modula2ReswordEnd,
+ \ modula2ProcedureIdent, modula2ProcedureLowLineIdent,
+ \ modula2Punctuation, modula2IllegalChar, modula2IllegalIdent
+
+syn keyword modula2ReswordModule contained MODULE
+syn keyword modula2ReswordProcedure contained PROCEDURE
+syn keyword modula2ReswordEnd contained END
+
+
+" -------------------------------------------------------------------------