Expand description
A spanned syntax tree for WGSL files. The root of the tree is a TranslationUnit.
Follwing the spec at this date: 2024-07-31. The syntax tree closely mirrors wgsl structure while allowing language extensions.
§Spanned
The following elements are Spanned to allow easy modification of the source code: Directives, Declarations, Statements, Expressions, Struct Members, Attributes, Idents, Template Arguments, Formal Parameters. … plus all language extensions, and maybe others.
Spans, if provided, are outer spans, meaning e.g. Statements include the ; and
Struct Members include the ,, but do not include the spaces between neighbor items.
Use the convenience methods to manipulate the spans as needed (TODO).
Re-exports§
pub use crate::syntax::BinaryOperator;pub use crate::syntax::DeclarationKind;pub use crate::syntax::DiagnosticSeverity;pub use crate::syntax::LiteralExpression;pub use crate::syntax::UnaryOperator;
Structs§
- Assignment
Statement - Attribute
- Binary
Expression - Compound
Statement - Const
Assert - Continuing
Statement - Declaration
- Diagnostic
Directive - Enable
Directive - ForStatement
- Formal
Parameter - Function
- Function
Call Expression - IfStatement
- Indexing
Expression - Loop
Statement - Named
Component Expression - Requires
Directive - Struct
- Struct
Member - Switch
Clause - Switch
Statement - Translation
Unit - Type
Alias - Type
Expression - Unary
Expression - While
Statement - With
Source