Add zig as compiler for parser

This commit is contained in:
maxxnino 2021-10-21 14:04:36 +09:00 committed by Stephan Seitz
parent 47a9e6dda9
commit e3e43c479e
2 changed files with 12 additions and 1 deletions

View file

@ -11,7 +11,7 @@ local shell = require "nvim-treesitter.shell_command_selectors"
local M = {}
local lockfile = {}
M.compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl" }
M.compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" }
M.prefer_git = fn.has "win32" == 1
M.command_extra_args = {}

View file

@ -65,6 +65,17 @@ function M.select_compiler_args(repo, compiler)
"-Os",
"/LD",
}
elseif string.match(compiler, "zig$") or string.match(compiler, "zig.exe$") then
return {
"c++",
"-o",
"parser.so",
repo.files,
"-lc",
"-Isrc",
"-shared",
"-Os",
}
else
local args = {
"-o",