Documentation
¶
Overview ¶
Package parser defines the AST node types for MX Script and the recursive-descent parser that builds an AST from a token stream.
Package parser implements a recursive-descent parser that converts a stream of tokens (produced by the lexer) into an MX Script AST.
Index ¶
- type ArrayLit
- type AssignStmt
- type BinaryExpr
- type BoolLit
- type CallExpr
- type Expr
- type ExprStmt
- type FnDecl
- type FnLit
- type Identifier
- type IfStmt
- type ImportStmt
- type IndexExpr
- type LetStmt
- type LoopStmt
- type MemberExpr
- type MiddlewareDecl
- type Node
- type NullLit
- type NumberLit
- type ObjectLit
- type ObjectPair
- type Parser
- type Program
- type ReturnStmt
- type RouteDecl
- type ServerBlock
- type Stmt
- type StringLit
- type TryStmt
- type UnaryExpr
- type UseStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignStmt ¶
type BinaryExpr ¶
type Expr ¶
type Expr interface {
Node
// contains filtered or unexported methods
}
Expr is the type implemented by all expression nodes.
type FnDecl ¶
type Identifier ¶
type Identifier struct {
Name string
// contains filtered or unexported fields
}
type ImportStmt ¶
type ImportStmt struct {
Path string
// contains filtered or unexported fields
}
type LoopStmt ¶
type LoopStmt struct {
Iterable Expr
Var string
Body []Stmt
// contains filtered or unexported fields
}
LoopStmt is `loop iterable as item { ... }` — iterates arrays / numeric ranges.
type MemberExpr ¶
type MiddlewareDecl ¶
type ObjectLit ¶
type ObjectLit struct {
Pairs []ObjectPair
// contains filtered or unexported fields
}
type ObjectPair ¶
type ReturnStmt ¶
type ReturnStmt struct {
Value Expr // nil if `return` with no value
// contains filtered or unexported fields
}
type RouteDecl ¶
type ServerBlock ¶
type ServerBlock struct {
Settings []ObjectPair
// contains filtered or unexported fields
}
type Stmt ¶
type Stmt interface {
Node
// contains filtered or unexported methods
}
Stmt is the type implemented by all statement / top-level declaration nodes.
type TryStmt ¶
Click to show internal directories.
Click to hide internal directories.