Documentation
¶
Index ¶
- type AssertStatement
- type AssignStatement
- type AugmentedAssignStatement
- type BlockStatement
- type Boolean
- type BreakStatement
- type CallExpression
- type CaseClause
- type ClassStatement
- type ConditionalExpression
- type ContinueStatement
- type DictComprehension
- type DictLiteral
- type ElifClause
- type ExceptClause
- type Expression
- type ExpressionStatement
- type FStringLiteral
- type FloatLiteral
- type ForStatement
- type FromImportStatement
- type FunctionLiteral
- type FunctionStatement
- type GlobalStatement
- type Identifier
- type IfStatement
- type ImportStatement
- type IndexExpression
- type InfixExpression
- type IntegerLiteral
- type Lambda
- type ListComprehension
- type ListLiteral
- type MatchStatement
- type MethodCallExpression
- type MultipleAssignStatement
- type Node
- type None
- type NonlocalStatement
- type OrPattern
- type PassStatement
- type PrefixExpression
- type Program
- type RaiseStatement
- type ReturnStatement
- type SetLiteral
- type SliceExpression
- type Statement
- type StringLiteral
- type TryStatement
- type TupleLiteral
- type WhileStatement
- type WithStatement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertStatement ¶
type AssertStatement struct {
Token token.Token
Condition Expression
Message Expression // Optional
}
func (*AssertStatement) Line ¶
func (as *AssertStatement) Line() int
func (*AssertStatement) TokenLiteral ¶
func (as *AssertStatement) TokenLiteral() string
type AssignStatement ¶
type AssignStatement struct {
Token token.Token
Left Expression
Value Expression
}
func (*AssignStatement) Line ¶
func (as *AssignStatement) Line() int
func (*AssignStatement) TokenLiteral ¶
func (as *AssignStatement) TokenLiteral() string
type AugmentedAssignStatement ¶
type AugmentedAssignStatement struct {
Token token.Token
Name *Identifier
Operator string
Value Expression
}
func (*AugmentedAssignStatement) Line ¶
func (aas *AugmentedAssignStatement) Line() int
func (*AugmentedAssignStatement) TokenLiteral ¶
func (aas *AugmentedAssignStatement) TokenLiteral() string
type BlockStatement ¶
func (*BlockStatement) Line ¶
func (bs *BlockStatement) Line() int
func (*BlockStatement) TokenLiteral ¶
func (bs *BlockStatement) TokenLiteral() string
type Boolean ¶
func (*Boolean) TokenLiteral ¶
type BreakStatement ¶
func (*BreakStatement) Line ¶
func (bs *BreakStatement) Line() int
func (*BreakStatement) TokenLiteral ¶
func (bs *BreakStatement) TokenLiteral() string
type CallExpression ¶
type CallExpression struct {
Token token.Token
Function Expression
Arguments []Expression
Keywords map[string]Expression
ArgsUnpack []Expression // For *args unpacking (supports multiple)
KwargsUnpack Expression // For **kwargs unpacking
}
func (*CallExpression) Line ¶
func (ce *CallExpression) Line() int
func (*CallExpression) TokenLiteral ¶
func (ce *CallExpression) TokenLiteral() string
type CaseClause ¶
type CaseClause struct {
Token token.Token // The 'case' token
Pattern Expression // The pattern to match (can be literal, identifier for type, dict, or wildcard)
Guard Expression // Optional guard condition (if clause)
Body *BlockStatement
CaptureAs *Identifier // Optional capture variable for the matched value
}
CaseClause represents a single case in a match statement
type ClassStatement ¶
type ClassStatement struct {
Token token.Token
Name *Identifier
BaseClass Expression // optional base class for inheritance (can be dotted like html.parser.HTMLParser)
Body *BlockStatement
Decorators []Expression // @decorator expressions, outermost first
}
func (*ClassStatement) Line ¶
func (cs *ClassStatement) Line() int
func (*ClassStatement) TokenLiteral ¶
func (cs *ClassStatement) TokenLiteral() string
type ConditionalExpression ¶
type ConditionalExpression struct {
Token token.Token
TrueExpr Expression
Condition Expression
FalseExpr Expression
}
func (*ConditionalExpression) Line ¶
func (ce *ConditionalExpression) Line() int
func (*ConditionalExpression) TokenLiteral ¶
func (ce *ConditionalExpression) TokenLiteral() string
type ContinueStatement ¶
func (*ContinueStatement) Line ¶
func (cs *ContinueStatement) Line() int
func (*ContinueStatement) TokenLiteral ¶
func (cs *ContinueStatement) TokenLiteral() string
type DictComprehension ¶ added in v0.2.0
type DictComprehension struct {
Token token.Token
Key Expression
Value Expression
Variables []Expression
Iterable Expression
Condition Expression // optional
}
func (*DictComprehension) Line ¶ added in v0.2.0
func (dc *DictComprehension) Line() int
func (*DictComprehension) TokenLiteral ¶ added in v0.2.0
func (dc *DictComprehension) TokenLiteral() string
type DictLiteral ¶
type DictLiteral struct {
Token token.Token
Pairs map[Expression]Expression
}
func (*DictLiteral) Line ¶
func (dl *DictLiteral) Line() int
func (*DictLiteral) TokenLiteral ¶
func (dl *DictLiteral) TokenLiteral() string
type ElifClause ¶
type ElifClause struct {
Token token.Token
Condition Expression
Consequence *BlockStatement
}
type ExceptClause ¶
type ExceptClause struct {
Token token.Token
ExceptType Expression // exception type to catch
ExceptVar *Identifier // variable to bind exception to
Body *BlockStatement
}
type Expression ¶
type Expression interface {
Node
// contains filtered or unexported methods
}
type ExpressionStatement ¶
type ExpressionStatement struct {
Token token.Token
Expression Expression
}
func (*ExpressionStatement) Line ¶
func (es *ExpressionStatement) Line() int
func (*ExpressionStatement) TokenLiteral ¶
func (es *ExpressionStatement) TokenLiteral() string
type FStringLiteral ¶
type FStringLiteral struct {
Token token.Token
Value string
Expressions []Expression // expressions inside {}
Parts []string // string parts between expressions
FormatSpecs []string // format specifiers for each expression (e.g., "2d" from {day:2d})
}
func (*FStringLiteral) Line ¶
func (fsl *FStringLiteral) Line() int
func (*FStringLiteral) TokenLiteral ¶
func (fsl *FStringLiteral) TokenLiteral() string
type FloatLiteral ¶
func (*FloatLiteral) Line ¶
func (fl *FloatLiteral) Line() int
func (*FloatLiteral) TokenLiteral ¶
func (fl *FloatLiteral) TokenLiteral() string
type ForStatement ¶
type ForStatement struct {
Token token.Token
Variables []Expression
Iterable Expression
Body *BlockStatement
Else *BlockStatement // optional else clause
}
func (*ForStatement) Line ¶
func (fs *ForStatement) Line() int
func (*ForStatement) TokenLiteral ¶
func (fs *ForStatement) TokenLiteral() string
type FromImportStatement ¶
type FromImportStatement struct {
Token token.Token // The 'from' token
Module *Identifier // The module name (e.g., "bs4" or "urllib.parse")
Names []*Identifier // The names to import (e.g., ["BeautifulSoup"])
Aliases []*Identifier // Optional aliases (for "import X as Y"), nil if no alias
}
FromImportStatement represents "from X import Y, Z" statements
func (*FromImportStatement) Line ¶
func (fis *FromImportStatement) Line() int
func (*FromImportStatement) TokenLiteral ¶
func (fis *FromImportStatement) TokenLiteral() string
type FunctionLiteral ¶
type FunctionLiteral struct {
Token token.Token
Parameters []*Identifier
DefaultValues map[string]Expression // parameter name -> default value
Variadic *Identifier // *args parameter (optional)
Kwargs *Identifier // **kwargs parameter (optional)
Body *BlockStatement
}
func (*FunctionLiteral) Line ¶
func (fl *FunctionLiteral) Line() int
func (*FunctionLiteral) TokenLiteral ¶
func (fl *FunctionLiteral) TokenLiteral() string
type FunctionStatement ¶
type FunctionStatement struct {
Token token.Token
Name *Identifier
Function *FunctionLiteral
Decorators []Expression // @decorator expressions, outermost first
}
func (*FunctionStatement) Line ¶
func (fs *FunctionStatement) Line() int
func (*FunctionStatement) TokenLiteral ¶
func (fs *FunctionStatement) TokenLiteral() string
type GlobalStatement ¶
type GlobalStatement struct {
Token token.Token
Names []*Identifier
}
func (*GlobalStatement) Line ¶
func (gs *GlobalStatement) Line() int
func (*GlobalStatement) TokenLiteral ¶
func (gs *GlobalStatement) TokenLiteral() string
type Identifier ¶
func (*Identifier) Line ¶
func (i *Identifier) Line() int
func (*Identifier) TokenLiteral ¶
func (i *Identifier) TokenLiteral() string
type IfStatement ¶
type IfStatement struct {
Token token.Token
Condition Expression
Consequence *BlockStatement
ElifClauses []*ElifClause
Alternative *BlockStatement
}
func (*IfStatement) Line ¶
func (is *IfStatement) Line() int
func (*IfStatement) TokenLiteral ¶
func (is *IfStatement) TokenLiteral() string
type ImportStatement ¶
type ImportStatement struct {
Token token.Token
Name *Identifier // The full dotted name stored as single identifier (e.g., "urllib.parse")
Alias *Identifier // Optional alias for 'import X as Y'
AdditionalNames []*Identifier // For import lib1, lib2, lib3
AdditionalAliases []*Identifier // Optional aliases for additional imports (for "import lib1 as alias1, lib2 as alias2")
}
func (*ImportStatement) FullName ¶
func (is *ImportStatement) FullName() string
FullName returns the complete import name (handles dotted imports like urllib.parse)
func (*ImportStatement) Line ¶
func (is *ImportStatement) Line() int
func (*ImportStatement) TokenLiteral ¶
func (is *ImportStatement) TokenLiteral() string
type IndexExpression ¶
type IndexExpression struct {
Token token.Token
Left Expression
Index Expression
}
func (*IndexExpression) Line ¶
func (ie *IndexExpression) Line() int
func (*IndexExpression) TokenLiteral ¶
func (ie *IndexExpression) TokenLiteral() string
type InfixExpression ¶
type InfixExpression struct {
Token token.Token
Left Expression
Operator string
Right Expression
}
func (*InfixExpression) Line ¶
func (ie *InfixExpression) Line() int
func (*InfixExpression) TokenLiteral ¶
func (ie *InfixExpression) TokenLiteral() string
type IntegerLiteral ¶
func (*IntegerLiteral) Line ¶
func (il *IntegerLiteral) Line() int
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
type Lambda ¶
type Lambda struct {
Token token.Token
Parameters []*Identifier
DefaultValues map[string]Expression
Variadic *Identifier // *args parameter (optional)
Kwargs *Identifier // **kwargs parameter (optional)
Body Expression // single expression, not block
}
func (*Lambda) TokenLiteral ¶
type ListComprehension ¶
type ListComprehension struct {
Token token.Token
Expression Expression
Variables []Expression // supports tuple unpacking like: for h, t in ...
Iterable Expression
Condition Expression // optional
}
func (*ListComprehension) Line ¶
func (lc *ListComprehension) Line() int
func (*ListComprehension) TokenLiteral ¶
func (lc *ListComprehension) TokenLiteral() string
type ListLiteral ¶
type ListLiteral struct {
Token token.Token
Elements []Expression
}
func (*ListLiteral) Line ¶
func (ll *ListLiteral) Line() int
func (*ListLiteral) TokenLiteral ¶
func (ll *ListLiteral) TokenLiteral() string
type MatchStatement ¶
type MatchStatement struct {
Token token.Token // The 'match' token
Subject Expression // The expression to match against
Cases []*CaseClause
}
MatchStatement represents a match statement with multiple case clauses
func (*MatchStatement) Line ¶
func (ms *MatchStatement) Line() int
func (*MatchStatement) TokenLiteral ¶
func (ms *MatchStatement) TokenLiteral() string
type MethodCallExpression ¶
type MethodCallExpression struct {
Token token.Token
Object Expression
Method *Identifier
Arguments []Expression
Keywords map[string]Expression
ArgsUnpack []Expression // For *args unpacking (supports multiple)
KwargsUnpack Expression // For **kwargs unpacking
}
func (*MethodCallExpression) Line ¶
func (mce *MethodCallExpression) Line() int
func (*MethodCallExpression) TokenLiteral ¶
func (mce *MethodCallExpression) TokenLiteral() string
type MultipleAssignStatement ¶
type MultipleAssignStatement struct {
Token token.Token
Names []*Identifier
Value Expression
StarredIndex int // Index of starred variable (-1 if none)
}
func (*MultipleAssignStatement) Line ¶
func (mas *MultipleAssignStatement) Line() int
func (*MultipleAssignStatement) TokenLiteral ¶
func (mas *MultipleAssignStatement) TokenLiteral() string
type None ¶
func (*None) TokenLiteral ¶
type NonlocalStatement ¶
type NonlocalStatement struct {
Token token.Token
Names []*Identifier
}
func (*NonlocalStatement) Line ¶
func (ns *NonlocalStatement) Line() int
func (*NonlocalStatement) TokenLiteral ¶
func (ns *NonlocalStatement) TokenLiteral() string
type OrPattern ¶ added in v0.2.0
type OrPattern struct {
Token token.Token
Patterns []Expression
}
OrPattern represents a pattern like `case 1 | 2 | 3:`
func (*OrPattern) TokenLiteral ¶ added in v0.2.0
type PassStatement ¶
func (*PassStatement) Line ¶
func (ps *PassStatement) Line() int
func (*PassStatement) TokenLiteral ¶
func (ps *PassStatement) TokenLiteral() string
type PrefixExpression ¶
type PrefixExpression struct {
Token token.Token
Operator string
Right Expression
}
func (*PrefixExpression) Line ¶
func (pe *PrefixExpression) Line() int
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
type RaiseStatement ¶
type RaiseStatement struct {
Token token.Token
Message Expression
}
func (*RaiseStatement) Line ¶
func (rs *RaiseStatement) Line() int
func (*RaiseStatement) TokenLiteral ¶
func (rs *RaiseStatement) TokenLiteral() string
type ReturnStatement ¶
type ReturnStatement struct {
Token token.Token
ReturnValue Expression
}
func (*ReturnStatement) Line ¶
func (rs *ReturnStatement) Line() int
func (*ReturnStatement) TokenLiteral ¶
func (rs *ReturnStatement) TokenLiteral() string
type SetLiteral ¶ added in v0.2.0
type SetLiteral struct {
Token token.Token
Elements []Expression
}
func (*SetLiteral) Line ¶ added in v0.2.0
func (sl *SetLiteral) Line() int
func (*SetLiteral) TokenLiteral ¶ added in v0.2.0
func (sl *SetLiteral) TokenLiteral() string
type SliceExpression ¶
type SliceExpression struct {
Token token.Token
Left Expression
Start Expression
End Expression
Step Expression
}
func (*SliceExpression) Line ¶
func (se *SliceExpression) Line() int
func (*SliceExpression) TokenLiteral ¶
func (se *SliceExpression) TokenLiteral() string
type StringLiteral ¶
func (*StringLiteral) Line ¶
func (sl *StringLiteral) Line() int
func (*StringLiteral) TokenLiteral ¶
func (sl *StringLiteral) TokenLiteral() string
type TryStatement ¶
type TryStatement struct {
Token token.Token
Body *BlockStatement
ExceptClauses []*ExceptClause // multiple except blocks
Finally *BlockStatement
}
func (*TryStatement) Line ¶
func (ts *TryStatement) Line() int
func (*TryStatement) TokenLiteral ¶
func (ts *TryStatement) TokenLiteral() string
type TupleLiteral ¶
type TupleLiteral struct {
Token token.Token
Elements []Expression
}
func (*TupleLiteral) Line ¶
func (tl *TupleLiteral) Line() int
func (*TupleLiteral) TokenLiteral ¶
func (tl *TupleLiteral) TokenLiteral() string
type WhileStatement ¶
type WhileStatement struct {
Token token.Token
Condition Expression
Body *BlockStatement
Else *BlockStatement // optional else clause
}
func (*WhileStatement) Line ¶
func (ws *WhileStatement) Line() int
func (*WhileStatement) TokenLiteral ¶
func (ws *WhileStatement) TokenLiteral() string
type WithStatement ¶ added in v0.2.0
type WithStatement struct {
Token token.Token
ContextExpr Expression
Target *Identifier // optional: 'as' binding
Body *BlockStatement
}
func (*WithStatement) Line ¶ added in v0.2.0
func (ws *WithStatement) Line() int
func (*WithStatement) TokenLiteral ¶ added in v0.2.0
func (ws *WithStatement) TokenLiteral() string
Click to show internal directories.
Click to hide internal directories.