@@ -145,7 +145,7 @@ local function is_rapid(bufnr, extension)
145145end
146146local line = nextnonblank (bufnr ,1 ):lower ()
147147-- Called from mod, prg or sys functions
148- return findany (line ,{ ' ^% s*%%%%%% ' , ' ^%s* module%s+.+% s*%(' , ' ^%s*module%s+.+%s*$ ' } )
148+ return matchre (line ,[[ \v^\ s*%(\%{3}| module\s+\k+\ s*%(\(|$)) ]] )
149149end
150150
151151function M .cfg (bufnr )
@@ -322,7 +322,7 @@ function M.frm(bufnr)
322322vim .bo [bufnr ].filetype = vim .g .filetype_frm
323323return
324324end
325- local lines = table.concat (getlines (bufnr ,1 ,5 ))
325+ local lines = table.concat (getlines (bufnr ,1 ,5 )): lower ()
326326if findany (lines ,visual_basic_content )then
327327vim .bo [bufnr ].filetype = ' vb'
328328else
380380
381381function M .idl (bufnr )
382382for _ ,line in ipairs (getlines (bufnr ,1 ,50 ))do
383- -- Always ignore case
384- line = line :lower ()
385- if findany (line , {' ^%s*import%s+"unknwn"%.idl' ,' ^%s*import%s+"objidl"%.idl' })then
383+ if findany (line :lower (), {' ^%s*import%s+"unknwn"%.idl' ,' ^%s*import%s+"objidl"%.idl' })then
386384vim .bo [bufnr ].filetype = ' msidl'
387385return
388386end
@@ -437,7 +435,7 @@ function M.m(bufnr)
437435
438436-- Excluding end(for|function|if|switch|while) common to Murphi
439437local octave_block_terminators =
440- [[ \%(^\|;\)\s*\ <end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>]]
438+ [[ \<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>]]
441439local objc_preprocessor = [[ ^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>]]
442440
443441-- Whether we've seen a multiline comment leader
@@ -456,7 +454,7 @@ function M.m(bufnr)
456454if
457455findany (line , {' ^%s*#' ,' ^%s*%%!' })
458456or matchre (line ,[[ ^\s*unwind_protect\>]] )
459- or matchre (line ,octave_block_terminators )
457+ or matchre (line ,[[ \%(^\|;\)\s* ]] .. octave_block_terminators )
460458then
461459vim .bo [bufnr ].filetype = ' octave'
462460return