py-tree-sitter
                                
                                 py-tree-sitter copied to clipboard
                                
                                    py-tree-sitter copied to clipboard
                            
                            
                            
                        Use c++17 for non-c files
https://github.com/tree-sitter/tree-sitter-haskell uses c++17 language features, so needs to be built with that flag.
Test output:
...........
----------------------------------------------------------------------
Ran 11 tests in 0.012s
OK
Blocking this on https://github.com/tree-sitter/tree-sitter-haskell/pull/38 for Windows support in CI
Don't C++17 features mean commands like tree-sitter test and tree-sitter parse won't work on macOS? ref https://github.com/tree-sitter/tree-sitter/issues/1246
Probably. I think I mentioned in the Haskell thread, tree sitter probably needs a better standardized approach to building C++ parsers.
This is no longer needed for tree-sitter-haskell, as that external scanner has been rewritten in plain C.
ah perfect. let me get the test-haskell branch up to date with that then close this PR, this issue is where I got stuck previously
Haskell looks to be failing on Windows Python 3.5 runner even with the new C parser: https://github.com/tree-sitter/py-tree-sitter/runs/5104795690?check_suite_focus=true
The Haskell scanner uses restrict, which MSVC only supports in C11 or C17 mode (and not the weird C89+extensions that is the default), but py-tree-sitter compiles .c files without flags on Windows.
I would like to see this change land.
On macOS, when trying to compile 'scanner.cc', the /usr/bin/cc compiler is invoked. That is:
$ cc --version Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: x86_64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
And this compiler defaults to not supporting C++ at all.
My particular example scanner.cc uses C++17 features, so this patch would be ideal.
Alternately, it would be sufficient to be able to pass compiler flags down through the interface.
Haskell's scanner is now back in C, and no we do not want to encourage using modern standards/features in a scanner, it is just not needed.