pub enum NodeKind {
Show 58 variants
File,
Error,
Import,
Struct,
Field,
TypeDecl,
Variant,
FnDecl,
ParamList,
Param,
Let,
Body,
Attr,
AttrPath,
Block,
Include,
IfStmt,
ForStmt,
Literal,
Str,
Interp,
Name,
Symbol,
SelfExpr,
List,
ListComp,
Map,
MapEntry,
MapComp,
StructLit,
Paren,
Call,
ArgList,
Arg,
FieldExpr,
IndexExpr,
BinaryExpr,
UnaryExpr,
IfExpr,
MatchExpr,
MatchArm,
LetExpr,
Binding,
Lambda,
PartExpr,
TypePath,
NamedType,
TypeArgList,
FnType,
RefinedType,
RangePredicate,
NamedPredicate,
WildcardPat,
LiteralPat,
NamePat,
VariantPat,
FieldPat,
OrPat,
}Expand description
The kind of a SyntaxNode.
Variants§
File
A whole source file: its declarations and statements.
Error
Tokens that could not be parsed. A diagnostic always explains them, unless the lexer already reported the tokens themselves.
Import
import "path" as alias.
Struct
struct Name { fields }.
Field
A field of a struct: name: Type = default block kind.
TypeDecl
type Name = variant | variant.
Variant
A variant of a sum type, with an optional parameter list.
FnDecl
fn name(params) -> Type = body.
ParamList
The parenthesized parameters of a function, lambda or variant.
Param
A parameter: name: Type = default.
Let
let name: Type = value, as a statement or a top-level declaration.
Body
{ statements }, the body of a block, an if, a for or a part.
Attr
path = value.
AttrPath
The dotted path of an attribute statement, such as a.b."c".
Block
kind label { body }, with an optional label.
Include
include value.
IfStmt
if condition { body } else { body } as a statement.
ForStmt
for name in collection { body }.
Literal
A literal token: an integer, a float, a path, true, false or
none.
Str
A string in any of its forms, including its interpolations.
Interp
#{ expression } inside a string.
Name
An identifier in expression position.
Symbol
A symbol word such as compiler@19:static in expression position.
SelfExpr
self.
List
[items].
ListComp
[for x in xs if guard -> value].
Map
{ key = value }, a map literal or a struct literal without a type
name.
MapEntry
key = value inside a map or struct literal.
MapComp
{for x in xs if guard -> key = value}.
StructLit
Type { key = value }.
Paren
(expression).
Call
callee(arguments).
ArgList
The parenthesized arguments of a call or a predicate.
Arg
An argument, positional or named as in name = value.
FieldExpr
base.field or base?.field.
IndexExpr
base[index].
BinaryExpr
lhs op rhs.
UnaryExpr
!operand or -operand.
IfExpr
if condition { value } else { value } as an expression.
MatchExpr
match scrutinee { arms }.
MatchArm
pattern if guard => value inside a match.
LetExpr
let bindings in body.
Binding
name: Type = value inside a let ... in expression.
Lambda
fn(params) -> Type = body.
PartExpr
part { body }.
TypePath
The name of a type, optionally qualified: Str or alias.Type.
NamedType
A type name with optional type arguments, such as Map<Str, Int>.
TypeArgList
<types> after a type name.
FnType
Fn(types) -> Type.
RefinedType
Type where predicate && predicate.
RangePredicate
A range predicate such as 1..=16, ..5 or 0...
NamedPredicate
A named predicate such as nonEmpty or matches(r"...").
WildcardPat
_.
LiteralPat
A literal pattern: an integer, a string, true, false or none.
NamePat
A name pattern: a binder or a nullary variant, optionally qualified.
VariantPat
A variant pattern with field patterns, such as check(cmd, ..).
FieldPat
name or name = pattern inside a variant pattern.
OrPat
pattern | pattern.