dannymcgee / vscode-wgsl

Rich language support for WebGPU Shading Language
Apache License 2.0
14 stars 1 forks source link

Support nested block comments #28

Closed dannymcgee closed 4 months ago

dannymcgee commented 4 months ago

This PR overhauls comment handling to support nested block comments. This was done by wrapping Gramatika's out-of-the-box ParseStream with an implementation that intercepts all peek, check and consume calls to check for comment-start tokens.

Comment nodes are stored in a separate buffer on this wrapper type that can be accessed by calling wgsl_parser::ParseStream::into_inner after parsing the syntax tree.

To accommodate error-handling while trying to parse comments, parse errors have also been moved to a separate buffer, which is also available on the type returned from into_inner.

Breaking Changes