mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
build/msvc: Fix preprocessor parsing
Preprocessor directives on the first line of the file were not being parsed.
This commit is contained in:
@@ -224,23 +224,15 @@ local static = header
|
|||||||
local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"'
|
local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"'
|
||||||
local curfile
|
local curfile
|
||||||
|
|
||||||
local init = 0
|
local init = 1
|
||||||
local curfile = nil
|
local curfile = nil
|
||||||
local neededfile = fname:match('[^/]+$')
|
local neededfile = fname:match('[^/]+$')
|
||||||
local declline = 0
|
local declline = 0
|
||||||
local declendpos = 0
|
local declendpos = 0
|
||||||
local curdir = nil
|
local curdir = nil
|
||||||
local is_needed_file = false
|
local is_needed_file = false
|
||||||
|
local init_is_nl = true
|
||||||
while init ~= nil do
|
while init ~= nil do
|
||||||
init = text:find('[\n;}]', init)
|
|
||||||
if init == nil then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
local init_is_nl = text:sub(init, init) == '\n'
|
|
||||||
init = init + 1
|
|
||||||
if init_is_nl and is_needed_file then
|
|
||||||
declline = declline + 1
|
|
||||||
end
|
|
||||||
if init_is_nl and text:sub(init, init) == '#' then
|
if init_is_nl and text:sub(init, init) == '#' then
|
||||||
local line, dir, file = text:match(filepattern, init)
|
local line, dir, file = text:match(filepattern, init)
|
||||||
if file ~= nil then
|
if file ~= nil then
|
||||||
@@ -293,6 +285,15 @@ while init ~= nil do
|
|||||||
declendpos = e
|
declendpos = e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
init = text:find('[\n;}]', init)
|
||||||
|
if init == nil then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
init_is_nl = text:sub(init, init) == '\n'
|
||||||
|
init = init + 1
|
||||||
|
if init_is_nl and is_needed_file then
|
||||||
|
declline = declline + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
non_static = non_static .. footer
|
non_static = non_static .. footer
|
||||||
|
Reference in New Issue
Block a user