-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to parse sqlite3.c #25
Comments
A shorthand was added for (from-file 'c "~/path/to/file.c") https://tree-sitter.github.io/tree-sitter/playground can be used to determine if this is tree-sitter generating the error. Similarly, calling This also appears to be generated with an older version of SEL since the root node should be an error-variation-point: SEL/SW/TS> (from-file 'c "~/Downloads/sqlite3.c.txt")
#<C ~/Downloads/sqlite3.c.txt>
SEL/SW/TS> (genome *)
#<C-ERROR-VARIATION-POINT 8 :TEXT "/*******************..."> Switching between which variation is used on the variation point can be done with |
This file takes a long time to parse, so I'm going to open up an internal issue for profiling it when someone gets a chance. |
I identified an O(N^2) algorithm in cl-tree-sitter that slows parsing of files with very long child lists, and submitted a pull request to death/cl-tree-sitter to fix it. |
Awesome.
|
I have also identified what is likely causing the slow parsing of sqlite3.c. It's due to repeated concatenate on octet vectors when handling error nodes. In sqlite3.c, almost the entire file ends up in an error node, so N is very large (the file has >200K lines.) Nathaniel is looking at this (it should be possible to get it down to linear time.) I will be adding some scalability tests to sel soon. Two of these illustrate the problem. Having said that, having almost all of the file in an error node is not very useful. This may be more of a tree-sitter issue. |
The problem, aside from
Notice the unmatched open braces. Tree-sitter will fail on this. I think someone could write a program that expanded the scope of ifdef/else blocks by pulling in following code (duplicating it) until all the braces, parents, etc. are balanced. |
I've opened an issue to add some documentation on variation points as there isn't anything in the manual at the moment. As a side note in regards to discoverability and so that you're aware of it, https://github.com/GrammaTech/sel/blob/master/components/configuration.lisp was recently added to help configure SEL parameters. |
scalability tests have been added to sel. They are not "actual" tests, but functions you can invoke inside |
The W.r.t. the errors, I think special bespoke handling for very common problem structures like |
Unable to parse the single-file sqlite3.c "amalgamation." The file is attached sqlite3.c.txt. The result is a single error AST.
The text was updated successfully, but these errors were encountered: