pythonast

package
v0.0.0-...-97278e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	Name   Identifier
	Asname *Identifier
}

import name with optional 'as' alias.

type AnnAssign

type AnnAssign struct {
	Target     Expr
	Annotation Expr
	Value      Expr
	Simple     bool
}

'simple' indicates that we annotate simple name without parens

type Arg

type Arg struct {
	Arg        Identifier
	Annotation Expr
}

type Arguments

type Arguments struct {
	Args       []Arg
	Vararg     *Arg
	Kwonlyargs []Arg
	KwDefaults []Expr
	Kwarg      *Arg
	Defaults   []Expr
}

type Assert

type Assert struct {
	Test Expr
	Msg  Expr
}

type Assign

type Assign struct {
	Targets []Expr
	Value   Expr
}

type AsyncFor

type AsyncFor struct {
	Target Expr
	Iter   Expr
	Body   []Stmt
	Orelse []Stmt
}

type AsyncFunctionDef

type AsyncFunctionDef struct {
	Name          Identifier
	Args          Arguments
	Body          []Stmt
	DecoratorList []Expr
	Returns       Expr
}

type AsyncWith

type AsyncWith struct {
	Items []WithItem
	Body  []Stmt
}

type Attribute

type Attribute struct {
	Value Expr
	Attr  Identifier
	Ctx   ExprContext
}

the following expression can appear in assignment context

func (Attribute) Precedence

func (Attribute) Precedence() int

type AugAssign

type AugAssign struct {
	Target Expr
	Op     Operator
	Value  Expr
}

type Await

type Await struct{ Value Expr }

the grammar constrains where yield expressions can occur

func (Await) Precedence

func (Await) Precedence() int

type BinOp

type BinOp struct {
	Left  Expr
	Op    Operator
	Right Expr
}

func (BinOp) Precedence

func (e BinOp) Precedence() int

type BoolOp

type BoolOp int
const (
	And BoolOp = iota
	Or
)

func (BoolOp) Precedence

func (o BoolOp) Precedence() int

type BoolOpExpr

type BoolOpExpr struct {
	Op     BoolOp
	Values []Expr
}

func (BoolOpExpr) Precedence

func (e BoolOpExpr) Precedence() int

type Break

type Break struct{}

type Bytes

type Bytes struct{ S []byte }

func (Bytes) Precedence

func (Bytes) Precedence() int

type Call

type Call struct {
	Func     Expr
	Args     []Expr
	Keywords []Keyword
}

func (Call) Precedence

func (Call) Precedence() int

type ClassDef

type ClassDef struct {
	Name          Identifier
	Bases         []Expr
	Keywords      []Keyword
	Body          []Stmt
	DecoratorList []Expr
}

type CmpOp

type CmpOp int
const (
	Eq CmpOp = iota
	NotEq
	Lt
	LtE
	Gt
	GtE
	Is
	IsNot
	In
	NotIn
)

type Comment

type Comment struct {
	Text string
}

type Compare

type Compare struct {
	Left        Expr
	Ops         []CmpOp
	Comparators []Expr
}

need sequences for compare to distinguish between x < 4 < 3 and struct {< x 4} < 3

func (Compare) Precedence

func (Compare) Precedence() int

type Comprehension

type Comprehension struct {
	Target  Expr
	Iter    Expr
	Ifs     []Expr
	IsAsync int
}

type ConstantExpr

type ConstantExpr struct{ Value interface{} }

func (ConstantExpr) Precedence

func (ConstantExpr) Precedence() int

type Continue

type Continue struct{}

type Delete

type Delete struct{ Targets []Expr }

type Dict

type Dict struct {
	Keys   []Expr
	Values []Expr
}

func (Dict) Precedence

func (Dict) Precedence() int

type DictComp

type DictComp struct {
	Key        Expr
	Value      Expr
	Generators []Comprehension
}

func (DictComp) Precedence

func (DictComp) Precedence() int

type DocString

type DocString struct{ Lines []string }

type Ellipsis

type Ellipsis struct{}

func (Ellipsis) Precedence

func (Ellipsis) Precedence() int

type ExceptHandler

type ExceptHandler struct {
	Typ  Expr
	Name Identifier
	Body []Stmt
}

type Expr

type Expr interface {
	Precedence() int
}

type ExprContext

type ExprContext int
const (
	LoadStore ExprContext = iota
	Del
	AugLoad
	AugStore
	Param
)

type ExprStmt

type ExprStmt struct{ Value Expr }

type ExtSlice

type ExtSlice struct{ Dims *Slice }

type For

type For struct {
	Target Expr
	Iter   Expr
	Body   []Stmt
	Orelse []Stmt
}

use 'orelse' because else is a keyword in target languages

type FormattedValue

type FormattedValue struct {
	Value      Expr
	Conversion *int
	FormatSpec Expr
}

func (FormattedValue) Precedence

func (FormattedValue) Precedence() int

type FunctionDef

type FunctionDef struct {
	Name          Identifier
	Args          Arguments
	Body          []Stmt
	DecoratorList []Expr
	Returns       Expr
}

type GeneratorExp

type GeneratorExp struct {
	Elt        Expr
	Generators []Comprehension
}

func (GeneratorExp) Precedence

func (GeneratorExp) Precedence() int

type Global

type Global struct{ Names []Identifier }

type Identifier

type Identifier string

type If

type If struct {
	Test   Expr
	Body   []Stmt
	Orelse []Stmt
}

type IfExp

type IfExp struct {
	Test   Expr
	Body   Expr
	Orelse Expr
}

func (IfExp) Precedence

func (IfExp) Precedence() int

type Import

type Import struct{ Names []Alias }

type ImportFrom

type ImportFrom struct {
	Module *Identifier
	Names  []Alias
	Level  *int
}

type Index

type Index struct{ Value Expr }

type JoinedStr

type JoinedStr struct{ Values []Expr }

func (JoinedStr) Precedence

func (JoinedStr) Precedence() int

type Keyword

type Keyword struct {
	Arg   *Identifier
	Value Expr
}

keyword arguments supplied to call (NULL identifier for **kwargs)

type Lambda

type Lambda struct {
	Args Arguments
	Body Expr
}

func (Lambda) Precedence

func (Lambda) Precedence() int

type List

type List struct {
	Elts []Expr
	Ctx  ExprContext
}

func (List) Precedence

func (List) Precedence() int

type ListComp

type ListComp struct {
	Elt        Expr
	Generators []Comprehension
}

func (ListComp) Precedence

func (ListComp) Precedence() int

type Module

type Module struct {
	Body []Stmt
}

type Name

type Name struct {
	Id  Identifier
	Ctx ExprContext
}

func (Name) Precedence

func (Name) Precedence() int

type NameConstant

type NameConstant struct{ Value Singleton }

func (NameConstant) Precedence

func (NameConstant) Precedence() int

type Nonlocal

type Nonlocal struct{ Names []Identifier }

type Num

type Num struct{ N string } // a number as a PyObject.

func (Num) Precedence

func (Num) Precedence() int

type Operator

type Operator int
const (
	Add Operator = iota
	Sub
	Mult
	MatMult
	Div
	Mod
	Pow
	LShift

	RShift
	BitOr
	BitXor
	BitAnd
	FloorDiv
)

func (Operator) Precedence

func (o Operator) Precedence() int

type Pass

type Pass struct{}

type Raise

type Raise struct {
	Exc   Expr
	Cause Expr
}

type RangeSlice

type RangeSlice struct {
	Lower Expr
	Upper Expr
	Step  Expr
}

type Return

type Return struct{ Value Expr }

type Set

type Set struct{ Elts []Expr }

func (Set) Precedence

func (Set) Precedence() int

type SetComp

type SetComp struct {
	Elt        Expr
	Generators []Comprehension
}

func (SetComp) Precedence

func (SetComp) Precedence() int

type Singleton

type Singleton int
const (
	None Singleton = iota
	True
	False
)

type Slice

type Slice interface {
	// contains filtered or unexported methods
}

type Starred

type Starred struct {
	Value Expr
	Ctx   ExprContext
}

func (Starred) Precedence

func (Starred) Precedence() int

type Stmt

type Stmt interface {
	// contains filtered or unexported methods
}

type Str

type Str struct{ S string } // need to specify raw; unicode; *etc

func (Str) Precedence

func (Str) Precedence() int

type Subscript

type Subscript struct {
	Value Expr
	Slice Slice
	Ctx   ExprContext
}

func (Subscript) Precedence

func (Subscript) Precedence() int

type Try

type Try struct {
	Body      []Stmt
	Handlers  []ExceptHandler
	Orelse    []Stmt
	Finalbody []Stmt
}

type Tuple

type Tuple struct {
	Elts []Expr
	Ctx  ExprContext
}

func (Tuple) Precedence

func (Tuple) Precedence() int

type UnaryOp

type UnaryOp int
const (
	Invert UnaryOp = iota
	Not
	UAdd
	USub
)

func (UnaryOp) Precedence

func (o UnaryOp) Precedence() int

type UnaryOpExpr

type UnaryOpExpr struct {
	Op      UnaryOp
	Operand Expr
}

func (UnaryOpExpr) Precedence

func (e UnaryOpExpr) Precedence() int

type While

type While struct {
	Test   Expr
	Body   []Stmt
	Orelse []Stmt
}

type With

type With struct {
	Items []WithItem
	Body  []Stmt
}

type WithItem

type WithItem struct {
	ContextExpr  Expr
	OptionalVars Expr
}

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) WriteExpr

func (w *Writer) WriteExpr(expr Expr)

func (*Writer) WriteModule

func (w *Writer) WriteModule(m *Module)

type Yield

type Yield struct{ Value Expr }

func (Yield) Precedence

func (Yield) Precedence() int

type YieldFrom

type YieldFrom struct{ Value Expr }

func (YieldFrom) Precedence

func (YieldFrom) Precedence() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL