Comment by dataflow
4 years ago
How in the world does it handle C++? With macros and all that being in C++, surely it's relying on some heuristics? (Which is fine; it's still an improvement. Just wondering if it's really working semantically.)
Also, one nice thing about diff is that it also gives you a patch that will turn the input into the output. Can this do that?
These tools simply don’t work well on anything more complicated than S-expressions. Every time I look into this space I end up disappointed.
Someone is working on tree-sitter for Perl too: https://github.com/ganezdragon/tree-sitter-perl
Which is supposed to be difficult, if not impossible: https://www.perlmonks.org/?node_id=663393
I suppose, though, if it's for diffs and syntax highlighting, flaws matter less.
Yeah I honestly wouldn't mind it even if it's a text-based heuristic; anything that's an improvement over line-by-line diff is a big win. I'm just wondering whether/how it's actually doing what it's actually advertised as doing, since it seems so much more difficult.
Short answer is that it doesn't: it lets tree-sitter do the heavy lifting to parse everything
Thanks! But then I guess my question is how does tree-sitter do it? I assume it has to choke on at least macros, right? Or does it call the actual compiler routines (like libclang)?