Closed akberg closed 7 months ago
Very interesting! Seems everything but the last line of the comment is duplicated. I’ll try to reproduce later. Until then could you post the output from running glsl_analyzer --parse-file <path> --print-ast
?
Also, did you build from source or use one of the precompiled binaries?
Good point, I'm using the version packed with the VSCode extension.
Now neither comments nor preprocessor defines are printed with the AST. Not sure how you are handling macros, judging from one of your other issue I'm guessing you're not (yet)?
Given Some bug.comp
#version 450
#define SNIPPET(x) \
do {\
x++;\
} while (0)
/** Some
multi-line
comment
*/
void main() {
SNIPPET(x);
}
glsl_analyzer --parse-file shaders/src/bug.comp --print-ast
file
function_declaration
identifier 'void'
identifier 'main'
parameter_list
(
)
block
{
statement
call
identifier 'SNIPPET'
(
argument
identifier 'x'
)
;
}
Right… the comments/macros are not shown in the AST printing (they are there, just in a different structure, which makes them harder to visualize). Sorry, it’s been a while since I worked on that code.
Good point, I'm using the version packed with the VSCode extension.
Okay, I’m just asking because I recently updated the master branch to a newer version of Zig, thinking it could be related, but it’s not, so that’s good.
Turned out to be a small typo:
- if (start < bytes.len) try self.writeLine(bytes[0..]);
+ if (start < bytes.len) try self.writeLine(bytes[start..]);
I've tagged a new release, it should be available for download in VSCode in a few minutes :)
When formatting with glsl_analyzer, multiline block comments seem to duplicate.
becomes
This is not an issue with multiple lines of C++ style line comments.
Same goes for multiline defines:
becomes
This might be connected to line endings, as these two cases are syntax which ignore line endings.