nolanderc / glsl_analyzer

Language server for GLSL (autocomplete, goto-definition, formatter, and more)
GNU General Public License v3.0
171 stars 4 forks source link

Run parse tests on larger code samples #11

Closed nolanderc closed 10 months ago

nolanderc commented 10 months ago

There have been a few bad parser bugs recently, which could have been caught if we had more/larger test cases which exercised more parts of the code.

automaticp commented 10 months ago

Perhaps you have already thought of that, but the glslang reference compiler has a ton of test glsl code. Look at this beauty of a file, for example.

It's mixed with a lot of irrelevant tests, unfortunately, so it probably needs some manual filtering, but that'd be my first place to look for lots of glsl.

Also thanks a bunch for the fixes on #6, #7, and #8, you rock!

automaticp commented 10 months ago

Also is there a way to run the parser standalone on a file and not as an lsp request? It would be easier to batch run this on a bunch of files if you could glsl_analyzer --dev-parse-file="test.glsl" or similar. Sorry, I know neither zig nor lsp, but I wouldn't mind gathering some glsl code and running the parser tests on it.

nolanderc commented 10 months ago

@automaticp Not currently. However it should be quite easy to add. I’ll take a look later

nolanderc commented 10 months ago

Added a --parse-file and --print-ast flag in v1.1.0

automaticp commented 10 months ago

Thank you, seems to work well. I've got some hits already, no crashes, but the parser seems to be unable to parse some well-formed (according to glslang) code and spits out invalid nodes.

I'll open an issue for the forthcoming reports on parser defects/crashes and will be posting problematic samples there as I find them. Tell me if you'd like an issue-per-bug instead.

nolanderc commented 10 months ago

You can keep them in a single issue since its probably fastest to just fix them all in bulk. If there's anything more complex we can split it out into its own issue later.

I should probably enable the diagnostics in the editor to make it easier to explore these issues interactively as well.

I'll have a look at what might be the cause of the issues tomorrow :slightly_smiling_face: