Documentation
¶
Index ¶
- type Binary
- func (e *Binary) End() core.Pos
- func (e *Binary) IsCallExpression() bool
- func (e *Binary) IsCompositeLiteral() bool
- func (e *Binary) IsScalarLiteral() bool
- func (e *Binary) IsUndefinedLiteral() bool
- func (e *Binary) LiteralToValue() (core.Value, bool)
- func (e *Binary) Pos() core.Pos
- func (e *Binary) String() string
- type Call
- func (e *Call) End() core.Pos
- func (e *Call) IsCallExpression() bool
- func (e *Call) IsCompositeLiteral() bool
- func (e *Call) IsScalarLiteral() bool
- func (e *Call) IsUndefinedLiteral() bool
- func (e *Call) LiteralToValue() (core.Value, bool)
- func (e *Call) Pos() core.Pos
- func (e *Call) String() string
- type FString
- func (e *FString) End() core.Pos
- func (e *FString) IsCallExpression() bool
- func (e *FString) IsCompositeLiteral() bool
- func (e *FString) IsScalarLiteral() bool
- func (e *FString) IsUndefinedLiteral() bool
- func (e *FString) LiteralToValue() (core.Value, bool)
- func (e *FString) Pos() core.Pos
- func (e *FString) String() string
- type FStringPart
- type Function
- func (e *Function) End() core.Pos
- func (e *Function) IsCallExpression() bool
- func (e *Function) IsCompositeLiteral() bool
- func (e *Function) IsScalarLiteral() bool
- func (e *Function) IsUndefinedLiteral() bool
- func (e *Function) LiteralToValue() (core.Value, bool)
- func (e *Function) Pos() core.Pos
- func (e *Function) String() string
- type FunctionType
- func (e *FunctionType) End() core.Pos
- func (e *FunctionType) IsCallExpression() bool
- func (e *FunctionType) IsCompositeLiteral() bool
- func (e *FunctionType) IsScalarLiteral() bool
- func (e *FunctionType) IsUndefinedLiteral() bool
- func (e *FunctionType) LiteralToValue() (core.Value, bool)
- func (e *FunctionType) Pos() core.Pos
- func (e *FunctionType) String() string
- type Identifier
- func (e *Identifier) End() core.Pos
- func (e *Identifier) IdentifierNode()
- func (e *Identifier) IsCallExpression() bool
- func (e *Identifier) IsCompositeLiteral() bool
- func (e *Identifier) IsScalarLiteral() bool
- func (e *Identifier) IsUndefinedLiteral() bool
- func (e *Identifier) LiteralToValue() (core.Value, bool)
- func (e *Identifier) Pos() core.Pos
- func (e *Identifier) String() string
- type Identifiers
- func (e *Identifiers) End() core.Pos
- func (e *Identifiers) IsCallExpression() bool
- func (e *Identifiers) IsCompositeLiteral() bool
- func (e *Identifiers) IsScalarLiteral() bool
- func (e *Identifiers) IsUndefinedLiteral() bool
- func (e *Identifiers) LiteralToValue() (core.Value, bool)
- func (e *Identifiers) NumFields() int
- func (e *Identifiers) Pos() core.Pos
- func (e *Identifiers) String() string
- type Immutable
- func (e *Immutable) End() core.Pos
- func (e *Immutable) IsCallExpression() bool
- func (e *Immutable) IsCompositeLiteral() bool
- func (e *Immutable) IsScalarLiteral() bool
- func (e *Immutable) IsUndefinedLiteral() bool
- func (e *Immutable) LiteralToValue() (core.Value, bool)
- func (e *Immutable) Pos() core.Pos
- func (e *Immutable) String() string
- type Import
- func (e *Import) End() core.Pos
- func (e *Import) IsCallExpression() bool
- func (e *Import) IsCompositeLiteral() bool
- func (e *Import) IsScalarLiteral() bool
- func (e *Import) IsUndefinedLiteral() bool
- func (e *Import) LiteralToValue() (core.Value, bool)
- func (e *Import) Pos() core.Pos
- func (e *Import) String() string
- type Index
- func (e *Index) End() core.Pos
- func (e *Index) IsCallExpression() bool
- func (e *Index) IsCompositeLiteral() bool
- func (e *Index) IsScalarLiteral() bool
- func (e *Index) IsUndefinedLiteral() bool
- func (e *Index) LiteralToValue() (core.Value, bool)
- func (e *Index) Pos() core.Pos
- func (e *Index) String() string
- type Invalid
- func (e *Invalid) End() core.Pos
- func (e *Invalid) IsCallExpression() bool
- func (e *Invalid) IsCompositeLiteral() bool
- func (e *Invalid) IsScalarLiteral() bool
- func (e *Invalid) IsUndefinedLiteral() bool
- func (e *Invalid) LiteralToValue() (core.Value, bool)
- func (e *Invalid) Pos() core.Pos
- func (e *Invalid) String() string
- type MethodCall
- func (e *MethodCall) End() core.Pos
- func (e *MethodCall) IsCallExpression() bool
- func (e *MethodCall) IsCompositeLiteral() bool
- func (e *MethodCall) IsScalarLiteral() bool
- func (e *MethodCall) IsUndefinedLiteral() bool
- func (e *MethodCall) LiteralToValue() (core.Value, bool)
- func (e *MethodCall) Pos() core.Pos
- func (e *MethodCall) String() string
- type Parenthesis
- func (e *Parenthesis) End() core.Pos
- func (e *Parenthesis) IsCallExpression() bool
- func (e *Parenthesis) IsCompositeLiteral() bool
- func (e *Parenthesis) IsScalarLiteral() bool
- func (e *Parenthesis) IsUndefinedLiteral() bool
- func (e *Parenthesis) LiteralToValue() (core.Value, bool)
- func (e *Parenthesis) Pos() core.Pos
- func (e *Parenthesis) String() string
- type Selector
- func (e *Selector) End() core.Pos
- func (e *Selector) IsCallExpression() bool
- func (e *Selector) IsCompositeLiteral() bool
- func (e *Selector) IsScalarLiteral() bool
- func (e *Selector) IsUndefinedLiteral() bool
- func (e *Selector) LiteralToValue() (core.Value, bool)
- func (e *Selector) Pos() core.Pos
- func (e *Selector) String() string
- type Slice
- func (e *Slice) End() core.Pos
- func (e *Slice) IsCallExpression() bool
- func (e *Slice) IsCompositeLiteral() bool
- func (e *Slice) IsScalarLiteral() bool
- func (e *Slice) IsUndefinedLiteral() bool
- func (e *Slice) LiteralToValue() (core.Value, bool)
- func (e *Slice) Pos() core.Pos
- func (e *Slice) String() string
- type Ternary
- func (e *Ternary) End() core.Pos
- func (e *Ternary) IsCallExpression() bool
- func (e *Ternary) IsCompositeLiteral() bool
- func (e *Ternary) IsScalarLiteral() bool
- func (e *Ternary) IsUndefinedLiteral() bool
- func (e *Ternary) LiteralToValue() (core.Value, bool)
- func (e *Ternary) Pos() core.Pos
- func (e *Ternary) String() string
- type Unary
- func (e *Unary) End() core.Pos
- func (e *Unary) IsCallExpression() bool
- func (e *Unary) IsCompositeLiteral() bool
- func (e *Unary) IsScalarLiteral() bool
- func (e *Unary) IsUndefinedLiteral() bool
- func (e *Unary) LiteralToValue() (core.Value, bool)
- func (e *Unary) Pos() core.Pos
- func (e *Unary) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binary ¶
type Binary struct {
LHS ast.Expression
RHS ast.Expression
Token token.Token
TokenPos core.Pos
}
Binary represents a binary operator expression.
func (*Binary) IsCallExpression ¶
func (*Binary) IsCompositeLiteral ¶
func (*Binary) IsScalarLiteral ¶
func (*Binary) IsUndefinedLiteral ¶
type Call ¶
type Call struct {
Func ast.Expression
LParen core.Pos
Args []ast.Expression
Ellipsis core.Pos
RParen core.Pos
}
Call represents a function call expression.
func (*Call) IsCallExpression ¶
func (*Call) IsCompositeLiteral ¶
func (*Call) IsScalarLiteral ¶
func (*Call) IsUndefinedLiteral ¶
type FString ¶
type FString struct {
Parts []FStringPart
ValuePos core.Pos
EndPos core.Pos
Literal string // original source text, including surrounding quotes
}
FString represents f-string literal: f"text {expr:fspec} ...". All format specs and literal text segments are resolved at parse time so the runtime cost of an f-string is the cost of its expression evaluations plus per-interpolation Format calls and string concatenation.
func (*FString) IsCallExpression ¶
func (*FString) IsCompositeLiteral ¶
func (*FString) IsScalarLiteral ¶
func (*FString) IsUndefinedLiteral ¶
type FStringPart ¶
type FStringPart struct {
// Literal text segment. Used when Expr == nil. Already unescaped from the f-string body (with `{{` / `}}` collapsed
// to single braces and the usual `\n`, `\"`, ... escapes processed).
Literal string
// Interpolated expression (parsed Kavun expression). Nil for literal segments.
Expr ast.Expression
// Pre-parsed format spec for the interpolation. Always valid for static interpolation parts; for literal parts and
// dynamic-spec interpolation parts it is the zero FormatSpec.
Spec fspec.FormatSpec
// Original spec text (the substring after the `:` inside `{...}`), without leading colon. Empty when no `:` was
// present or when the fspec was empty. For dynamic specs this is the raw template (including `{...}` placeholders);
// it is only used for de-duplication and disassembly.
SpecText string
// Dynamic format-spec template. Set only when the spec contains nested `{expr}` placeholders. The runtime spec
// string is built by interleaving SpecLiterals[i] with str(SpecExprs[i]) and ending with
// SpecLiterals[len(SpecExprs)]. When SpecExprs is non-empty, Spec is unused and the spec is parsed at run time.
SpecLiterals []string
SpecExprs []ast.Expression
}
FStringPart is a single segment of an f-string. Exactly one of Literal or Expr is set: when Expr == nil the part is a verbatim literal text; when Expr != nil the part is an interpolation that must be Format()-ed with the pre-parsed Spec at run time.
type Function ¶
type Function struct {
Type *FunctionType
Body *statement.Block
}
Function represents a function literal.
func (*Function) IsCallExpression ¶
func (*Function) IsCompositeLiteral ¶
func (*Function) IsScalarLiteral ¶
func (*Function) IsUndefinedLiteral ¶
type FunctionType ¶
type FunctionType struct {
FuncPos core.Pos
Params *Identifiers
// Result is the optional named return identifier:
// func(a, b) name { ... }
// When non-nil, `name` is allocated as a local pre-initialized to undefined; bare `return` and exit-after-recover
// return its current value.
Result *Identifier
}
FunctionType represents a function type definition.
func (*FunctionType) End ¶
func (e *FunctionType) End() core.Pos
func (*FunctionType) IsCallExpression ¶
func (e *FunctionType) IsCallExpression() bool
func (*FunctionType) IsCompositeLiteral ¶
func (e *FunctionType) IsCompositeLiteral() bool
func (*FunctionType) IsScalarLiteral ¶
func (e *FunctionType) IsScalarLiteral() bool
func (*FunctionType) IsUndefinedLiteral ¶
func (e *FunctionType) IsUndefinedLiteral() bool
func (*FunctionType) LiteralToValue ¶
func (e *FunctionType) LiteralToValue() (core.Value, bool)
func (*FunctionType) Pos ¶
func (e *FunctionType) Pos() core.Pos
func (*FunctionType) String ¶
func (e *FunctionType) String() string
type Identifier ¶
Identifier represents an identifier.
func (*Identifier) End ¶
func (e *Identifier) End() core.Pos
func (*Identifier) IdentifierNode ¶
func (e *Identifier) IdentifierNode()
func (*Identifier) IsCallExpression ¶
func (e *Identifier) IsCallExpression() bool
func (*Identifier) IsCompositeLiteral ¶
func (e *Identifier) IsCompositeLiteral() bool
func (*Identifier) IsScalarLiteral ¶
func (e *Identifier) IsScalarLiteral() bool
func (*Identifier) IsUndefinedLiteral ¶
func (e *Identifier) IsUndefinedLiteral() bool
func (*Identifier) LiteralToValue ¶
func (e *Identifier) LiteralToValue() (core.Value, bool)
func (*Identifier) Pos ¶
func (e *Identifier) Pos() core.Pos
func (*Identifier) String ¶
func (e *Identifier) String() string
type Identifiers ¶
Identifiers represents a list of identifiers.
func (*Identifiers) End ¶
func (e *Identifiers) End() core.Pos
func (*Identifiers) IsCallExpression ¶
func (e *Identifiers) IsCallExpression() bool
func (*Identifiers) IsCompositeLiteral ¶
func (e *Identifiers) IsCompositeLiteral() bool
func (*Identifiers) IsScalarLiteral ¶
func (e *Identifiers) IsScalarLiteral() bool
func (*Identifiers) IsUndefinedLiteral ¶
func (e *Identifiers) IsUndefinedLiteral() bool
func (*Identifiers) LiteralToValue ¶
func (e *Identifiers) LiteralToValue() (core.Value, bool)
func (*Identifiers) NumFields ¶
func (e *Identifiers) NumFields() int
func (*Identifiers) Pos ¶
func (e *Identifiers) Pos() core.Pos
func (*Identifiers) String ¶
func (e *Identifiers) String() string
type Immutable ¶
Immutable represents an immutable expression
func (*Immutable) IsCallExpression ¶
func (*Immutable) IsCompositeLiteral ¶
func (*Immutable) IsScalarLiteral ¶
func (*Immutable) IsUndefinedLiteral ¶
type Import ¶
Import represents an import expression
func (*Import) IsCallExpression ¶
func (*Import) IsCompositeLiteral ¶
func (*Import) IsScalarLiteral ¶
func (*Import) IsUndefinedLiteral ¶
type Index ¶
type Index struct {
Expr ast.Expression
LBrack core.Pos
Index ast.Expression
RBrack core.Pos
}
Index represents an index expression.
func (*Index) IsCallExpression ¶
func (*Index) IsCompositeLiteral ¶
func (*Index) IsScalarLiteral ¶
func (*Index) IsUndefinedLiteral ¶
type Invalid ¶
Invalid represents invalid expression.
func (*Invalid) IsCallExpression ¶
func (*Invalid) IsCompositeLiteral ¶
func (*Invalid) IsScalarLiteral ¶
func (*Invalid) IsUndefinedLiteral ¶
type MethodCall ¶
type MethodCall struct {
Object ast.Expression
MethodName string
MethodPos core.Pos
LParen core.Pos
Args []ast.Expression
Ellipsis core.Pos
RParen core.Pos
}
MethodCall represents a method call expression.
func (*MethodCall) End ¶
func (e *MethodCall) End() core.Pos
func (*MethodCall) IsCallExpression ¶
func (e *MethodCall) IsCallExpression() bool
func (*MethodCall) IsCompositeLiteral ¶
func (e *MethodCall) IsCompositeLiteral() bool
func (*MethodCall) IsScalarLiteral ¶
func (e *MethodCall) IsScalarLiteral() bool
func (*MethodCall) IsUndefinedLiteral ¶
func (e *MethodCall) IsUndefinedLiteral() bool
func (*MethodCall) LiteralToValue ¶
func (e *MethodCall) LiteralToValue() (core.Value, bool)
func (*MethodCall) Pos ¶
func (e *MethodCall) Pos() core.Pos
func (*MethodCall) String ¶
func (e *MethodCall) String() string
type Parenthesis ¶
Parenthesis represents a parenthesis wrapped expression.
func (*Parenthesis) End ¶
func (e *Parenthesis) End() core.Pos
func (*Parenthesis) IsCallExpression ¶
func (e *Parenthesis) IsCallExpression() bool
func (*Parenthesis) IsCompositeLiteral ¶
func (e *Parenthesis) IsCompositeLiteral() bool
func (*Parenthesis) IsScalarLiteral ¶
func (e *Parenthesis) IsScalarLiteral() bool
func (*Parenthesis) IsUndefinedLiteral ¶
func (e *Parenthesis) IsUndefinedLiteral() bool
func (*Parenthesis) LiteralToValue ¶
func (e *Parenthesis) LiteralToValue() (core.Value, bool)
func (*Parenthesis) Pos ¶
func (e *Parenthesis) Pos() core.Pos
func (*Parenthesis) String ¶
func (e *Parenthesis) String() string
type Selector ¶
type Selector struct {
Expr ast.Expression
Sel ast.Expression
}
Selector represents a selector expression.
func (*Selector) IsCallExpression ¶
func (*Selector) IsCompositeLiteral ¶
func (*Selector) IsScalarLiteral ¶
func (*Selector) IsUndefinedLiteral ¶
type Slice ¶
type Slice struct {
Expr ast.Expression
LBrack core.Pos
Low ast.Expression
High ast.Expression
Step ast.Expression
RBrack core.Pos
}
Slice represents a slice expression.
func (*Slice) IsCallExpression ¶
func (*Slice) IsCompositeLiteral ¶
func (*Slice) IsScalarLiteral ¶
func (*Slice) IsUndefinedLiteral ¶
type Ternary ¶
type Ternary struct {
Cond ast.Expression
True ast.Expression
False ast.Expression
QuestionPos core.Pos
ColonPos core.Pos
}
Ternary represents a ternary conditional expression.
func (*Ternary) IsCallExpression ¶
func (*Ternary) IsCompositeLiteral ¶
func (*Ternary) IsScalarLiteral ¶
func (*Ternary) IsUndefinedLiteral ¶
type Unary ¶
Unary represents an unary operator expression.