Documentation ¶
Overview ¶
Package ast defines all the nodes for a SubC AST.
Index ¶
- func NotNilFilter(_ string, v reflect.Value) bool
- func Print(x interface{}) (err error)
- type Affix
- type ArrayType
- type BadDecl
- type BadExpr
- type BadStmt
- type BasicLit
- type BasicType
- type BinaryExpr
- type BlockStmt
- type BranchStmt
- type CallExpr
- type CaseClause
- type CastExpr
- type CompositeLit
- type CondExpr
- type ConstDecl
- type Decl
- type Directive
- type DoStmt
- type EmptyStmt
- type EnumDecl
- type Expr
- type ExprStmt
- type FieldDecl
- type FieldFilter
- type ForStmt
- type FuncDecl
- type FuncType
- type GotoStmt
- type Ident
- type IfStmt
- type IndexExpr
- type LabeledStmt
- type Node
- type ParenExpr
- type Prog
- type RecordDecl
- type RecordType
- type ReturnStmt
- type SelectorExpr
- type SizeofExpr
- type StarExpr
- type Stmt
- type StringLit
- type SwitchStmt
- type UnaryExpr
- type VarDecl
- type WhileStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NotNilFilter ¶
NotNilFilter filters out nil nodes.
Types ¶
type Affix ¶
type Affix int
Affix defines what type of unary expression it is. It is used for the ++/-- operators to say if the operator is ++x or x++.
type BinaryExpr ¶
BinaryExpr represents a binary expression.
func (*BinaryExpr) Span ¶
func (e *BinaryExpr) Span() scan.Span
type BranchStmt ¶
BranchStmt represents a branch statement, such as a break, continue or goto.
type CaseClause ¶
CaseClause represents a case statement inside a switch statement.
func (*CaseClause) Span ¶
func (s *CaseClause) Span() scan.Span
type CompositeLit ¶
CompositeLit represents an initialization list for arrays.
func (*CompositeLit) Span ¶
func (e *CompositeLit) Span() scan.Span
type DoStmt ¶
type DoStmt struct { Do scan.Token Body Stmt While scan.Token Lparen scan.Token Cond Expr Rparen scan.Token }
DoStmt represents a do-while statement.
type EnumDecl ¶
type EnumDecl struct { Storage *scan.Token Enum scan.Token Name *Ident Lbrace scan.Token List []*ConstDecl Rbrace scan.Token }
EnumDecl is a enum declaration.
type ExprStmt ¶
type ExprStmt struct {
X Expr
}
ExprStmt is a wrapper for expressions that can appear as a statement. Examples include call expressions and assignment expressions.
type FieldFilter ¶
FieldFilter is a function used to filter out nodes.
type ForStmt ¶
type ForStmt struct { For scan.Token Lparen scan.Token Init Expr Cond Expr Post Expr Rparen scan.Token Body Stmt }
ForStmt represents a for statement.
type FuncDecl ¶
type FuncDecl struct { Storage *scan.Token Result Expr Name *Ident Lparen scan.Token Params []*FieldDecl Rparen scan.Token Labels []*LabeledStmt Decls []Decl Body *BlockStmt }
FuncDecl is a function declaration.
type FuncType ¶
type FuncType struct { Result Expr Star scan.Token Params []Expr Lparen [2]scan.Token Rparen [2]scan.Token }
FuncType represents a function pointer declaration.
type IfStmt ¶
type IfStmt struct { If scan.Token Lparen scan.Token Cond Expr Rparen scan.Token Body Stmt Else Stmt }
IfStmt represents an if statement.
type LabeledStmt ¶
LabeledStmt represents a labeled statement.
func (*LabeledStmt) Span ¶
func (s *LabeledStmt) Span() scan.Span
type Prog ¶
type Prog struct {
Decls []Decl
}
Prog represents the top level of the AST tree, it holds all the top level declarations.
type RecordDecl ¶
type RecordDecl struct { Storage *scan.Token Record scan.Token Name *Ident Lbrace scan.Token Fields []*FieldDecl Rbrace scan.Token }
RecordDecl is a struct or union declaration.
func (*RecordDecl) Span ¶
func (d *RecordDecl) Span() scan.Span
type RecordType ¶
RecordType represents a record declaration.
func (*RecordType) Span ¶
func (t *RecordType) Span() scan.Span
type ReturnStmt ¶
ReturnStmt represents a return statement.
func (*ReturnStmt) Span ¶
func (s *ReturnStmt) Span() scan.Span
type SelectorExpr ¶
SelectorExpr represents a record access using the . or -> operator.
func (*SelectorExpr) Span ¶
func (e *SelectorExpr) Span() scan.Span
type SizeofExpr ¶
SizeofExpr represents a sizeof expression.
func (*SizeofExpr) Span ¶
func (e *SizeofExpr) Span() scan.Span
type StringLit ¶
type StringLit struct {
Lits []*BasicLit
}
StringLit represents string literals that are concatenated together. Example includes char *s = "a" "b" where "a" and "b" would be inside one StringLit.
type SwitchStmt ¶
type SwitchStmt struct { Switch scan.Token Lparen scan.Token Tag Expr Rparen scan.Token Body *BlockStmt }
SwitchStmt represents a switch statement.
func (*SwitchStmt) Span ¶
func (s *SwitchStmt) Span() scan.Span