patch 8.2.3679: objc file detected as Octave

Problem:    objc file detected as Octave. (Antony Lee)
Solution:   Detect objc by preprocessor lines. (Doug Kearns, closes #9223,
            closes #9220)
This commit is contained in:
Doug Kearns
2021-11-26 13:01:41 +00:00
committed by Bram Moolenaar
parent 85be8563fe
commit 7329cfab36
3 changed files with 15 additions and 1 deletions

View File

@ -272,6 +272,8 @@ func dist#ft#FTm()
" excluding end(for|function|if|switch|while) common to Murphi
let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
let objc_preprocessor = '^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>'
let n = 1
let saw_comment = 0 " Whether we've seen a multiline comment leader.
while n < 100
@ -282,7 +284,7 @@ func dist#ft#FTm()
" anything more definitive.
let saw_comment = 1
endif
if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)'
if line =~ '^\s*//' || line =~ '^\s*@import\>' || line =~ objc_preprocessor
setf objc
return
endif