Module syntax_spanned

Source
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§

AssignmentStatement
Attribute
BinaryExpression
CompoundStatement
ConstAssert
ContinuingStatement
Declaration
DiagnosticDirective
EnableDirective
ForStatement
FormalParameter
Function
FunctionCallExpression
IfStatement
IndexingExpression
LoopStatement
NamedComponentExpression
RequiresDirective
Struct
StructMember
SwitchClause
SwitchStatement
TranslationUnit
TypeAlias
TypeExpression
UnaryExpression
WhileStatement
WithSource

Enums§

AssignmentOperator
CaseSelector
Expression
GlobalDeclaration
GlobalDirective
Statement

Traits§

SpannedSyntax

Type Aliases§

BreakIfStatement
ConstAssertStatement
DeclarationStatement
DecrementStatement
FunctionCallStatement
IdentifierExpression
IncrementStatement
ParenthesizedExpression
ReturnStatement
TemplateArg