pub enum Expr {
Show 21 variants
Prefix(PrefixExpr),
Postfix(PostfixExpr),
Infix(InfixExpr),
Paren(ParenExpr),
FunctionCall(FunctionCall),
IntegerLit(IntegerLit),
FloatLit(FloatLit),
StringLit(StringLit),
BooleanLit(BooleanLit),
Path(Path),
ListExpr(ListExpr),
DivertTarget(DivertTargetExpr),
ArrayLiteral(ArrayLiteral),
MapLiteral(MapLiteral),
Index(IndexExpr),
StructLiteral(StructLiteral),
FieldAccess(FieldAccessExpr),
FnLiteral(FnLiteral),
RefExpr(RefExpr),
ComputedCall(CallExpr),
Range(RangeExpr),
}Expand description
A typed expression node.
Covers every node kind the Pratt expression parser can produce.
Variants§
Prefix(PrefixExpr)
Postfix(PostfixExpr)
Infix(InfixExpr)
Paren(ParenExpr)
FunctionCall(FunctionCall)
IntegerLit(IntegerLit)
FloatLit(FloatLit)
StringLit(StringLit)
BooleanLit(BooleanLit)
Path(Path)
ListExpr(ListExpr)
DivertTarget(DivertTargetExpr)
ArrayLiteral(ArrayLiteral)
#[expr, …] — array sigil literal (T1b §3, brink extension).
MapLiteral(MapLiteral)
#{key: expr, …} — map sigil literal (T1b §3, brink extension).
Index(IndexExpr)
base[index] — postfix indexing (T1b §4, brink extension).
StructLiteral(StructLiteral)
Name#{field: expr, …} — struct construction literal (TM-4b,
docs/typed-mode-spec.md §6, brink extension).
FieldAccess(FieldAccessExpr)
base.field — postfix field access (TM-4b, docs/typed-mode-spec.md
§6, brink extension). Only produced where the dotted-PATH grammar
doesn’t already cover the shape — see FIELD_ACCESS_EXPR’s doc.
FnLiteral(FnLiteral)
#fn(target, args…) — function-value creation (T1c,
docs/t1c-spec.md §2, brink extension).
RefExpr(RefExpr)
ref lvalue-path — path-projection creation (T1e,
docs/t1e-spec.md §2, brink extension). Legal only in ref-argument
position (calls, #fn(…), bind(…)) — a brink-analyzer concern,
not a grammar one.
ComputedCall(CallExpr)
expr(args…) where expr isn’t a bare identifier immediately
followed by ( (that shape is FunctionCall) — a computed callee
(indexed, field access, call-result, parenthesized, …). Parses so
the call syntax and its args aren’t silently reinterpreted as
trailing prose text; always rejected at HIR lowering (E104,
docs/t1c-spec.md §3/§10, issue #869) since Direct-call syntax is
RULED to a bare variable/temp/param callee only.
Range(RangeExpr)
a..b / a..=b — range literal (NS-A5, docs/stdlib-spec.md §7,
brink extension).
Trait Implementations§
Source§impl AstNode for Expr
impl AstNode for Expr
Source§fn can_cast(kind: SyntaxKind) -> bool
fn can_cast(kind: SyntaxKind) -> bool
true if a node with the given kind can be cast to Self.Source§fn cast(node: SyntaxNode) -> Option<Self>
fn cast(node: SyntaxNode) -> Option<Self>
SyntaxNode into this typed wrapper.Source§fn syntax(&self) -> &SyntaxNode
fn syntax(&self) -> &SyntaxNode
SyntaxNode.