uyha / tree-sitter-cmake

A Tree-sitter parser for CMake
MIT License
41 stars 9 forks source link

refactor(pt2): use C for the external scanner #16

Closed amaanq closed 1 year ago

amaanq commented 1 year ago

try ts t or ts p <file> and it should be fine now

uyha commented 1 year ago

I think scan needs to be static also and I don't think inline is needed

uyha commented 1 year ago

also is_bracket_argument

uyha commented 1 year ago

basically any functions that were in the anonymous namespace will have to be static

amaanq commented 1 year ago

The reason advance needs to be static is because (I believe) it conflicts with the lexer->advance function, so it is attempting to call itself, resulting in the segfault. I could be completely wrong of course. But the others dont need to be...but I can make them static anyways

uyha commented 1 year ago

Just to make them have the same semantic with the C++ file, in the C++ version, having them in the anonymous namespace make them have internal linkage, which makes sure they are not conflict with any other same name functions. Hence when switching to C, making them all static to have the same linkage. Also inline doesn't do anything here so plesae remove them.

amaanq commented 1 year ago

ok, done

uyha commented 1 year ago

you need to update the binding.gyp and build.rs

amaanq commented 1 year ago

done