From 68a89470693c7687d4e736ca056c05de632e3ac7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 5 Jan 2024 17:59:04 +0100 Subject: patch 9.1.0013: Modula2 filetype support lacking 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 Signed-off-by: Benjamin Kowarsch Signed-off-by: Christian Brabandt --- src/Makefile | 8 +++++++- src/testdir/test_filetype.vim | 38 +++++++++++++++++++++++++++++++++++++- src/version.c | 2 ++ 3 files changed, 46 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 0d8f150f1d..59511d2b34 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2338,7 +2338,8 @@ installruntime: installrtbase installmacros installpack installtutor installspel # Also install most of the other runtime files. installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT) \ $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) \ - $(DEST_SYN) $(DEST_SYN)/shared $(DEST_IND) $(DEST_FTP) \ + $(DEST_SYN) $(DEST_SYN)/modula2 $(DEST_SYN)/modula2/opt $(DEST_SYN)/shared \ + $(DEST_IND) $(DEST_FTP) \ $(DEST_AUTO) $(DEST_AUTO)/dist $(DEST_AUTO)/xml $(DEST_AUTO)/zig \ $(DEST_IMPORT) $(DEST_IMPORT)/dist \ $(DEST_PLUG) $(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP) @@ -2413,6 +2414,8 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT) \ cd $(DEST_SYN); chmod $(HELPMOD) *.vim README.txt cd $(SYNSOURCE)/shared; $(INSTALL_DATA) *.vim README.txt $(DEST_SYN)/shared cd $(DEST_SYN)/shared; chmod $(HELPMOD) *.vim README.txt + cd $(SYNSOURCE)/modula2/opt; $(INSTALL_DATA) *.vim $(DEST_SYN)/modula2/opt + cd $(DEST_SYN)/modula2/opt; chmod $(HELPMOD) *.vim # install the indent files cd $(INDSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_IND) cd $(DEST_IND); chmod $(HELPMOD) *.vim README.txt @@ -2661,6 +2664,7 @@ $(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE): $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ $(DEST_VIM) $(DEST_RT) $(DEST_HELP) \ $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_SYN)/shared \ + $(DEST_SYN)/modula2 $(DEST_SYN)/modula2/opt \ $(DEST_IND) $(DEST_FTP) \ $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) $(DEST_MACRO) \ $(DEST_PACK) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ @@ -2838,6 +2842,7 @@ uninstall_runtime: -rm -rf $(DEST_COL)/tools -rm -rf $(DEST_COL)/lists -rm -f $(DEST_SYN)/shared/*.vim $(DEST_SYN)/shared/README.txt + -rm -f $(DEST_SYN)/modula2/opt/*.vim -rm -f $(DEST_SYN)/*.vim $(DEST_SYN)/README.txt -rm -f $(DEST_IND)/*.vim $(DEST_IND)/README.txt -rm -rf $(DEST_MACRO) @@ -2850,6 +2855,7 @@ uninstall_runtime: -rm -rf $(DEST_COMP) -rm -f $(DEST_PRINT)/*.ps -rmdir $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN)/shared + -rmdir $(DEST_SYN)/modula2/opt $(DEST_SYN)/modula2 -rmdir $(DEST_SYN) $(DEST_IND) -rm -rf $(DEST_FTP)/*.vim $(DEST_FTP)/README.txt $(DEST_FTP)/logtalk.dict -rm -f $(DEST_AUTO)/*.vim $(DEST_AUTO)/README.txt diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index fe22069a53..6913eec57c 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -453,7 +453,6 @@ def s:GetFilenameChecks(): dict> mma: ['file.nb'], mmp: ['file.mmp'], modconf: ['/etc/modules.conf', '/etc/modules', '/etc/conf.modules', '/etc/modprobe.file', 'any/etc/conf.modules', 'any/etc/modprobe.file', 'any/etc/modules', 'any/etc/modules.conf'], - modula2: ['file.m2', 'file.mi'], modula3: ['file.m3', 'file.mg', 'file.i3', 'file.ig', 'file.lm3'], monk: ['file.isc', 'file.monk', 'file.ssc', 'file.tsc'], moo: ['file.moo'], @@ -1642,13 +1641,16 @@ func Test_mod_file() call writefile(['IMPLEMENTATION MODULE Module2Mod;'], 'modfile.MOD') split modfile.MOD call assert_equal('modula2', &filetype) + call assert_equal('pim', b:modula2.dialect) bwipe! " Modula-2 with comment and empty lines prior MODULE call writefile(['', '(* with', ' comment *)', '', 'MODULE Module2Mod;'], 'modfile.MOD') split modfile.MOD call assert_equal('modula2', &filetype) + call assert_equal('pim', b:modula2.dialect) bwipe! + call delete('modfile.MOD') " LambdaProlog module @@ -2376,4 +2378,38 @@ func Test_i_file() filetype off endfunc +func Test_def_file() + filetype on + + call writefile(['this is the fallback'], 'Xfile.def', 'D') + split Xfile.def + call assert_equal('def', &filetype) + bwipe! + + " Test dist#ft#FTdef() + + let g:filetype_def = 'modula2' + split Xfile.def + call assert_equal('modula2', &filetype) + call assert_equal('pim', b:modula2.dialect) + bwipe! + unlet g:filetype_def + + " Modula-2 + + call writefile(['(* a Modula-2 comment *)'], 'Xfile.def') + split Xfile.def + call assert_equal('modula2', &filetype) + call assert_equal('pim', b:modula2.dialect) + bwipe! + + call writefile(['IMPLEMENTATION MODULE Module2Mod;'], 'Xfile.def') + split Xfile.def + call assert_equal('modula2', &filetype) + call assert_equal('pim', b:modula2.dialect) + bwipe! + + filetype off +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 35865d696f..8f6446fd88 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 13, /**/ 12, /**/ -- cgit v1.2.3