diff options
author | b-r-o-c-k <brockmammen@gmail.com> | 2018-02-28 19:14:27 -0600 |
---|---|---|
committer | b-r-o-c-k <brockmammen@gmail.com> | 2018-02-28 19:37:58 -0600 |
commit | 69da692b0adbd9168d002eaffb02bd59c64044b2 (patch) | |
tree | 3f8ead69fb2c855d89d1cac7b33e65a92dcb14a2 | |
parent | 611351677dba450fc1a312061572c44c7e3d6482 (diff) | |
download | rneovim-69da692b0adbd9168d002eaffb02bd59c64044b2.tar.gz rneovim-69da692b0adbd9168d002eaffb02bd59c64044b2.tar.bz2 rneovim-69da692b0adbd9168d002eaffb02bd59c64044b2.zip |
build/msvc: Fix preprocessor parsing
Preprocessor directives on the first line of the file were not being parsed.
-rwxr-xr-x | src/nvim/generators/gen_declarations.lua | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/nvim/generators/gen_declarations.lua b/src/nvim/generators/gen_declarations.lua index 065c043557..c40c37bb3e 100755 --- a/src/nvim/generators/gen_declarations.lua +++ b/src/nvim/generators/gen_declarations.lua @@ -224,23 +224,15 @@ local static = header local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"' local curfile -local init = 0 +local init = 1 local curfile = nil local neededfile = fname:match('[^/]+$') local declline = 0 local declendpos = 0 local curdir = nil local is_needed_file = false +local init_is_nl = true 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 local line, dir, file = text:match(filepattern, init) if file ~= nil then @@ -293,6 +285,15 @@ while init ~= nil do declendpos = e 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 non_static = non_static .. footer |