Documentation ¶
Index ¶
- Constants
- Variables
- func Dump(ast Ast) string
- func Walk(ast Ast, Visit func(Ast) bool)
- type AST
- type Alias
- type Arg
- type Arguments
- type Assert
- type Assign
- type Ast
- type Attribute
- type AugAssign
- type BinOp
- type BoolOp
- type BoolOpNumber
- type Break
- type Bytes
- type Call
- type ClassDef
- type CmpOp
- type Compare
- type Comprehension
- type Continue
- type Delete
- type Dict
- type DictComp
- type Ellipsis
- type ExceptHandler
- type Expr
- type ExprBase
- type ExprContext
- type ExprStmt
- type Expression
- type ExtSlice
- type For
- type FunctionDef
- type GeneratorExp
- type Global
- type Identifier
- type If
- type IfExp
- type Import
- type ImportFrom
- type Index
- type Interactive
- type Keyword
- type Lambda
- type List
- type ListComp
- type Mod
- type ModBase
- type Module
- type Name
- type NameConstant
- type Nonlocal
- type Num
- type Object
- type OperatorNumber
- type Pass
- type Pos
- type Raise
- type Return
- type Set
- type SetComp
- type SetCtxer
- type Singleton
- type Slice
- type SliceBase
- type Slicer
- type Starred
- type Stmt
- type StmtBase
- type Str
- type String
- type Subscript
- type Suite
- type Try
- type Tuple
- type UnaryOp
- type UnaryOpNumber
- type While
- type With
- type WithItem
- type Yield
- type YieldFrom
Constants ¶
View Source
const ( Load = ExprContext(iota + 1) Store Del AugLoad AugStore Param )
View Source
const ( And = BoolOpNumber(iota + 1) Or )
View Source
const ( Add = OperatorNumber(iota + 1) Sub Mult Div Modulo Pow LShift RShift BitOr BitXor BitAnd FloorDiv )
View Source
const ( Invert = UnaryOpNumber(iota + 1) Not UAdd USub )
View Source
const ( Eq = CmpOp(iota + 1) NotEq Lt LtE Gt GtE Is IsNot In NotIn )
Variables ¶
View Source
var ASTType = py.ObjectType.NewTypeFlags("AST", "AST Node", nil, nil, py.ObjectType.Flags|py.TPFLAGS_BASE_EXC_SUBCLASS)
Python types
View Source
var AliasType = ASTType.NewType("Alias", "Alias Node", nil, nil)
View Source
var ArgType = ASTType.NewType("Arg", "Arg Node", nil, nil)
View Source
var ArgumentsType = ASTType.NewType("Arguments", "Arguments Node", nil, nil)
View Source
var AssertType = StmtBaseType.NewType("Assert", "Assert Node", nil, nil)
View Source
var AssignType = StmtBaseType.NewType("Assign", "Assign Node", nil, nil)
View Source
var AttributeType = ExprBaseType.NewType("Attribute", "Attribute Node", nil, nil)
View Source
var AugAssignType = StmtBaseType.NewType("AugAssign", "AugAssign Node", nil, nil)
View Source
var BinOpType = ExprBaseType.NewType("BinOp", "BinOp Node", nil, nil)
View Source
var BoolOpType = ExprBaseType.NewType("BoolOp", "BoolOp Node", nil, nil)
View Source
var BreakType = StmtBaseType.NewType("Break", "Break Node", nil, nil)
View Source
var BytesType = ExprBaseType.NewType("Bytes", "Bytes Node", nil, nil)
View Source
var CallType = ExprBaseType.NewType("Call", "Call Node", nil, nil)
View Source
var ClassDefType = StmtBaseType.NewType("ClassDef", "ClassDef Node", nil, nil)
View Source
var CompareType = ExprBaseType.NewType("Compare", "Compare Node", nil, nil)
View Source
var ContinueType = StmtBaseType.NewType("Continue", "Continue Node", nil, nil)
View Source
var DeleteType = StmtBaseType.NewType("Delete", "Delete Node", nil, nil)
View Source
var DictCompType = ExprBaseType.NewType("DictComp", "DictComp Node", nil, nil)
View Source
var DictType = ExprBaseType.NewType("Dict", "Dict Node", nil, nil)
View Source
var EllipsisType = ExprBaseType.NewType("Ellipsis", "Ellipsis Node", nil, nil)
View Source
var ExceptHandlerType = ASTType.NewType("ExceptHandler", "ExceptHandler Node", nil, nil)
Misc
View Source
var ExprBaseType = ASTType.NewType("Expr", "Expr Node", nil, nil)
Expr
View Source
var ExprStmtType = StmtBaseType.NewType("ExprStmt", "ExprStmt Node", nil, nil)
View Source
var ExpressionType = ModBaseType.NewType("Expression", "Expression Node", nil, nil)
View Source
var ExtSliceType = SliceBaseType.NewType("ExtSlice", "ExtSlice Node", nil, nil)
View Source
var ForType = StmtBaseType.NewType("For", "For Node", nil, nil)
View Source
var FunctionDefType = StmtBaseType.NewType("FunctionDef", "FunctionDef Node", nil, nil)
View Source
var GeneratorExpType = ExprBaseType.NewType("GeneratorExp", "GeneratorExp Node", nil, nil)
View Source
var GlobalType = StmtBaseType.NewType("Global", "Global Node", nil, nil)
View Source
var IfExpType = ExprBaseType.NewType("IfExp", "IfExp Node", nil, nil)
View Source
var IfType = StmtBaseType.NewType("If", "If Node", nil, nil)
View Source
var ImportFromType = StmtBaseType.NewType("ImportFrom", "ImportFrom Node", nil, nil)
View Source
var ImportType = StmtBaseType.NewType("Import", "Import Node", nil, nil)
View Source
var IndexType = SliceBaseType.NewType("Index", "Index Node", nil, nil)
View Source
var InteractiveType = ModBaseType.NewType("Interactive", "Interactive Node", nil, nil)
View Source
var KeywordType = ASTType.NewType("Keyword", "Keyword Node", nil, nil)
View Source
var LambdaType = ExprBaseType.NewType("Lambda", "Lambda Node", nil, nil)
View Source
var ListCompType = ExprBaseType.NewType("ListComp", "ListComp Node", nil, nil)
View Source
var ListType = ExprBaseType.NewType("List", "List Node", nil, nil)
View Source
var ModBaseType = ASTType.NewType("Mod", "Mod Node", nil, nil)
Mod
View Source
var ModuleType = ModBaseType.NewType("Module", "Module Node", nil, nil)
View Source
var NameConstantType = ExprBaseType.NewType("NameConstant", "NameConstant Node", nil, nil)
View Source
var NameType = ExprBaseType.NewType("Name", "Name Node", nil, nil)
View Source
var NonlocalType = StmtBaseType.NewType("Nonlocal", "Nonlocal Node", nil, nil)
View Source
var NumType = ExprBaseType.NewType("Num", "Num Node", nil, nil)
View Source
var PassType = StmtBaseType.NewType("Pass", "Pass Node", nil, nil)
View Source
var RaiseType = StmtBaseType.NewType("Raise", "Raise Node", nil, nil)
View Source
var ReturnType = StmtBaseType.NewType("Return", "Return Node", nil, nil)
View Source
var SetCompType = ExprBaseType.NewType("SetComp", "SetComp Node", nil, nil)
View Source
var SetType = ExprBaseType.NewType("Set", "Set Node", nil, nil)
View Source
var SliceBaseType = ASTType.NewType("SliceBase", "SliceBase Node", nil, nil)
View Source
var SliceType = SliceBaseType.NewType("Slice", "Slice Node", nil, nil)
Slicer
View Source
var StarredType = ExprBaseType.NewType("Starred", "Starred Node", nil, nil)
View Source
var StmtBaseType = ASTType.NewType("Stmt", "Stmt Node", nil, nil)
Stmt
View Source
var StrType = ExprBaseType.NewType("Str", "Str Node", nil, nil)
View Source
var SubscriptType = ExprBaseType.NewType("Subscript", "Subscript Node", nil, nil)
View Source
var SuiteType = ModBaseType.NewType("Suite", "Suite Node", nil, nil)
View Source
var TryType = StmtBaseType.NewType("Try", "Try Node", nil, nil)
View Source
var TupleType = ExprBaseType.NewType("Tuple", "Tuple Node", nil, nil)
View Source
var UnaryOpType = ExprBaseType.NewType("UnaryOp", "UnaryOp Node", nil, nil)
View Source
var WhileType = StmtBaseType.NewType("While", "While Node", nil, nil)
View Source
var WithItemType = ASTType.NewType("WithItem", "WithItem Node", nil, nil)
View Source
var WithType = StmtBaseType.NewType("With", "With Node", nil, nil)
View Source
var YieldFromType = ExprBaseType.NewType("YieldFrom", "YieldFrom Node", nil, nil)
View Source
var YieldType = ExprBaseType.NewType("Yield", "Yield Node", nil, nil)
Functions ¶
Types ¶
type Alias ¶
type Alias struct { Pos Name Identifier AsName Identifier }
type Arg ¶
type Arg struct { Pos Arg Identifier Annotation Expr }
type Arguments ¶
type Attribute ¶
type Attribute struct { ExprBase Value Expr Attr Identifier Ctx ExprContext }
func (*Attribute) SetCtx ¶
func (o *Attribute) SetCtx(Ctx ExprContext)
type BoolOp ¶
type BoolOp struct { ExprBase Op BoolOpNumber Values []Expr }
type BoolOpNumber ¶
type BoolOpNumber int
func (BoolOpNumber) String ¶
func (o BoolOpNumber) String() string
type ClassDef ¶
type Comprehension ¶
type ExceptHandler ¶
type ExceptHandler struct { Pos ExprType Expr Name Identifier Body []Stmt }
func (*ExceptHandler) Type ¶
func (o *ExceptHandler) Type() *py.Type
type Expr ¶
type Expr interface { Ast // contains filtered or unexported methods }
All ExprBase notes implement the Expr interface
type ExprContext ¶
type ExprContext int
func (ExprContext) String ¶
func (o ExprContext) String() string
type Expression ¶
func (*Expression) Type ¶
func (o *Expression) Type() *py.Type
type FunctionDef ¶
type FunctionDef struct { StmtBase Name Identifier Args *Arguments Body []Stmt DecoratorList []Expr Returns Expr }
func (*FunctionDef) Type ¶
func (o *FunctionDef) Type() *py.Type
type GeneratorExp ¶
type GeneratorExp struct { ExprBase Elt Expr Generators []Comprehension }
func (*GeneratorExp) Type ¶
func (o *GeneratorExp) Type() *py.Type
type Global ¶
type Global struct { StmtBase Names []Identifier }
type Identifier ¶
type ImportFrom ¶
type ImportFrom struct { StmtBase Module Identifier Names []*Alias Level int }
func (*ImportFrom) Type ¶
func (o *ImportFrom) Type() *py.Type
type Interactive ¶
func (*Interactive) Type ¶
func (o *Interactive) Type() *py.Type
type Keyword ¶
type Keyword struct { Pos Arg Identifier Value Expr }
type List ¶
type List struct { ExprBase Elts []Expr Ctx ExprContext }
func (*List) SetCtx ¶
func (o *List) SetCtx(Ctx ExprContext)
type ListComp ¶
type ListComp struct { ExprBase Elt Expr Generators []Comprehension }
type Mod ¶
type Mod interface { Ast // contains filtered or unexported methods }
All ModBase nodes implement the Mod interface
type Name ¶
type Name struct { ExprBase Id Identifier Ctx ExprContext }
func (*Name) SetCtx ¶
func (o *Name) SetCtx(Ctx ExprContext)
type NameConstant ¶
func (*NameConstant) Type ¶
func (o *NameConstant) Type() *py.Type
type Nonlocal ¶
type Nonlocal struct { StmtBase Names []Identifier }
type OperatorNumber ¶
type OperatorNumber int
func (OperatorNumber) String ¶
func (o OperatorNumber) String() string
type SetComp ¶
type SetComp struct { ExprBase Elt Expr Generators []Comprehension }
type SetCtxer ¶
type SetCtxer interface {
SetCtx(ExprContext)
}
ExprNodes which have a settable context implement this
type Slicer ¶
type Slicer interface { Ast // contains filtered or unexported methods }
All SliceBase nodes implement the Slicer interface
type Starred ¶
type Starred struct { ExprBase Value Expr Ctx ExprContext }
func (*Starred) SetCtx ¶
func (o *Starred) SetCtx(Ctx ExprContext)
type Stmt ¶
type Stmt interface { Ast // contains filtered or unexported methods }
All StmtBase nodes implement the Stmt interface
type Subscript ¶
type Subscript struct { ExprBase Value Expr Slice Slicer Ctx ExprContext }
func (*Subscript) SetCtx ¶
func (o *Subscript) SetCtx(Ctx ExprContext)
type Try ¶
type Try struct { StmtBase Body []Stmt Handlers []*ExceptHandler Orelse []Stmt Finalbody []Stmt }
type Tuple ¶
type Tuple struct { ExprBase Elts []Expr Ctx ExprContext }
func (*Tuple) SetCtx ¶
func (o *Tuple) SetCtx(Ctx ExprContext)
type UnaryOp ¶
type UnaryOp struct { ExprBase Op UnaryOpNumber Operand Expr }
type UnaryOpNumber ¶
type UnaryOpNumber int
func (UnaryOpNumber) String ¶
func (o UnaryOpNumber) String() string
Click to show internal directories.
Click to hide internal directories.