elixir-lang / tree-sitter-elixir

Elixir grammar for tree-sitter
https://elixir-lang.org/tree-sitter-elixir
Apache License 2.0
245 stars 24 forks source link

Compilation issue #6

Closed alappe closed 2 years ago

alappe commented 2 years ago

Hello,

when I use :TSInstallSync elixir in neovim, I get:

Downloading...
Creating temporary directory
Extracting...
Compiling...
src/scanner.cc:110:31: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
  for (const char& terminator : token_terminators) {
                              ^
src/scanner.cc:601:12: error: use of undeclared identifier 'nullptr'
    return nullptr;
           ^
1 warning and 1 error generated.
Error during compilation
Failed to execute the following command:
{
  cmd = "cc",
  err = "Error during compilation",
  info = "Compiling...",
  opts = {
    args = { "-o", "parser.so", "-I./src", "src/parser.c", "src/scanner.cc", "-shared", "-Os", "-lstdc++", "-fPIC" },
    cwd = "/Users/nd/.local/share/nvim/tree-sitter-elixir"
  }
}
alappe commented 2 years ago

Cloning the directory and using tree-sitter generate && tree-sitter test fails with the same error, so it's not about neovim.

Running on MacOS 11.6.

jonatanklosko commented 2 years ago

It's definitely related to the code using C++11 features, and your compiler probably defaults to an older standard (and nvim-treesitter doesn't specify any). Since these are just two specific places, I will just adjust the code to use different constructs :)