ast

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 6 Imported by: 35

Documentation

Overview

Package ast parses the clang AST output into AST structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError added in v0.11.3

func CheckError(e error, n Node)

func IsWarning added in v0.11.3

func IsWarning(e error, n Node) bool

func Position added in v0.11.3

func Position(node Node) string

Position returns the position of the node in the original file. If the position cannot be determined an empty string is returned.

func WarningOrError added in v0.11.3

func WarningOrError(e error, n Node, isError bool)

Types

type AlignedAttr added in v0.11.2

type AlignedAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*AlignedAttr) AddChild added in v0.11.2

func (n *AlignedAttr) AddChild(node Node)

type AlwaysInlineAttr

type AlwaysInlineAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*AlwaysInlineAttr) AddChild

func (n *AlwaysInlineAttr) AddChild(node Node)

type ArrayFiller added in v0.11.2

type ArrayFiller struct {
	Children []Node
}

func (*ArrayFiller) AddChild added in v0.11.2

func (n *ArrayFiller) AddChild(node Node)

type ArraySubscriptExpr

type ArraySubscriptExpr struct {
	Address  string
	Position string
	Type     string
	Kind     string
	Children []Node
}

func (*ArraySubscriptExpr) AddChild

func (n *ArraySubscriptExpr) AddChild(node Node)

type AsmLabelAttr

type AsmLabelAttr struct {
	Address      string
	Position     string
	FunctionName string
	Children     []Node
}

func (*AsmLabelAttr) AddChild

func (n *AsmLabelAttr) AddChild(node Node)

type AvailabilityAttr

type AvailabilityAttr struct {
	Address       string
	Position      string
	OS            string
	Version       string
	Unknown1      float64
	Unknown2      int
	IsUnavailable bool
	Message1      string
	Message2      string
	IsInherited   bool
	Children      []Node
}

func (*AvailabilityAttr) AddChild

func (n *AvailabilityAttr) AddChild(node Node)

type BinaryOperator

type BinaryOperator struct {
	Address  string
	Position string
	Type     string
	Operator string
	Children []Node
}

func (*BinaryOperator) AddChild

func (n *BinaryOperator) AddChild(node Node)

type BreakStmt

type BreakStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*BreakStmt) AddChild

func (n *BreakStmt) AddChild(node Node)

type BuiltinType

type BuiltinType struct {
	Address  string
	Type     string
	Children []Node
}

func (*BuiltinType) AddChild

func (n *BuiltinType) AddChild(node Node)

type CStyleCastExpr

type CStyleCastExpr struct {
	Address  string
	Position string
	Type     string
	Kind     string
	Children []Node
}

func (*CStyleCastExpr) AddChild

func (n *CStyleCastExpr) AddChild(node Node)

type CallExpr

type CallExpr struct {
	Address  string
	Position string
	Type     string
	Children []Node
}

func (*CallExpr) AddChild

func (n *CallExpr) AddChild(node Node)

type CaseStmt added in v0.9.2

type CaseStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*CaseStmt) AddChild added in v0.9.2

func (n *CaseStmt) AddChild(node Node)

type CharacterLiteral

type CharacterLiteral struct {
	Address  string
	Position string
	Type     string
	Value    int
	Children []Node
}

func (*CharacterLiteral) AddChild

func (n *CharacterLiteral) AddChild(node Node)

type CompoundAssignOperator added in v0.10.4

type CompoundAssignOperator struct {
	Address               string
	Position              string
	Type                  string
	Opcode                string
	ComputationLHSType    string
	ComputationResultType string
	Children              []Node
}

func (*CompoundAssignOperator) AddChild added in v0.10.4

func (n *CompoundAssignOperator) AddChild(node Node)

type CompoundStmt

type CompoundStmt struct {
	Address  string
	Position string
	Children []Node

	// TODO: remove this
	BelongsToSwitch bool
}

func (*CompoundStmt) AddChild

func (n *CompoundStmt) AddChild(node Node)

type ConditionalOperator

type ConditionalOperator struct {
	Address  string
	Position string
	Type     string
	Children []Node
}

func (*ConditionalOperator) AddChild

func (n *ConditionalOperator) AddChild(node Node)

type ConstAttr

type ConstAttr struct {
	Address  string
	Position string
	Tags     string
	Children []Node
}

func (*ConstAttr) AddChild

func (n *ConstAttr) AddChild(node Node)

type ConstantArrayType

type ConstantArrayType struct {
	Address  string
	Type     string
	Size     int
	Children []Node
}

func (*ConstantArrayType) AddChild

func (n *ConstantArrayType) AddChild(node Node)

type ContinueStmt added in v0.10.2

type ContinueStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*ContinueStmt) AddChild added in v0.10.2

func (n *ContinueStmt) AddChild(node Node)

type DeclRefExpr

type DeclRefExpr struct {
	Address  string
	Position string
	Type     string
	Lvalue   bool
	For      string
	Address2 string
	Name     string
	Type2    string
	Children []Node
}

func (*DeclRefExpr) AddChild

func (n *DeclRefExpr) AddChild(node Node)

type DeclStmt

type DeclStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*DeclStmt) AddChild

func (n *DeclStmt) AddChild(node Node)

type DefaultStmt added in v0.9.2

type DefaultStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*DefaultStmt) AddChild added in v0.9.2

func (n *DefaultStmt) AddChild(node Node)

type DeprecatedAttr

type DeprecatedAttr struct {
	Address  string
	Position string
	Message1 string
	Message2 string
	Children []Node
}

func (*DeprecatedAttr) AddChild

func (n *DeprecatedAttr) AddChild(node Node)

type DoStmt added in v0.9.0

type DoStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*DoStmt) AddChild added in v0.9.0

func (n *DoStmt) AddChild(node Node)

type ElaboratedType

type ElaboratedType struct {
	Address  string
	Type     string
	Tags     string
	Children []Node
}

func (*ElaboratedType) AddChild

func (n *ElaboratedType) AddChild(node Node)

type Enum

type Enum struct {
	Address  string
	Name     string
	Children []Node
}

func (*Enum) AddChild

func (n *Enum) AddChild(node Node)

type EnumConstantDecl

type EnumConstantDecl struct {
	Address    string
	Position   string
	Position2  string
	Referenced bool
	Name       string
	Type       string
	Children   []Node
}

func (*EnumConstantDecl) AddChild

func (n *EnumConstantDecl) AddChild(node Node)

type EnumDecl

type EnumDecl struct {
	Address   string
	Position  string
	Position2 string
	Name      string
	Children  []Node
}

func (*EnumDecl) AddChild

func (n *EnumDecl) AddChild(node Node)

type EnumType

type EnumType struct {
	Address  string
	Name     string
	Children []Node
}

func (*EnumType) AddChild

func (n *EnumType) AddChild(node Node)

type FieldDecl

type FieldDecl struct {
	Address    string
	Position   string
	Position2  string
	Name       string
	Type       string
	Referenced bool
	Children   []Node
}

func (*FieldDecl) AddChild

func (n *FieldDecl) AddChild(node Node)

type FloatingLiteral

type FloatingLiteral struct {
	Address  string
	Position string
	Type     string
	Value    float64
	Children []Node
}

func (*FloatingLiteral) AddChild

func (n *FloatingLiteral) AddChild(node Node)

type ForStmt

type ForStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*ForStmt) AddChild

func (n *ForStmt) AddChild(node Node)

type FormatAttr

type FormatAttr struct {
	Address      string
	Position     string
	Implicit     bool
	Inherited    bool
	FunctionName string
	Unknown1     int
	Unknown2     int
	Children     []Node
}

func (*FormatAttr) AddChild

func (n *FormatAttr) AddChild(node Node)

type FunctionDecl

type FunctionDecl struct {
	Address      string
	Position     string
	Prev         string
	Position2    string
	Name         string
	Type         string
	IsExtern     bool
	IsImplicit   bool
	IsUsed       bool
	IsReferenced bool
	Children     []Node
}

func (*FunctionDecl) AddChild

func (n *FunctionDecl) AddChild(node Node)

type FunctionProtoType

type FunctionProtoType struct {
	Address  string
	Type     string
	Kind     string
	Children []Node
}

func (*FunctionProtoType) AddChild

func (n *FunctionProtoType) AddChild(node Node)

type GotoStmt added in v0.11.2

type GotoStmt struct {
	Address   string
	Position  string
	Name      string
	Position2 string
	Children  []Node
}

func (*GotoStmt) AddChild added in v0.11.2

func (n *GotoStmt) AddChild(node Node)

type IfStmt

type IfStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*IfStmt) AddChild

func (n *IfStmt) AddChild(node Node)

type ImplicitCastExpr

type ImplicitCastExpr struct {
	Address  string
	Position string
	Type     string
	Kind     string
	Children []Node
}

func (*ImplicitCastExpr) AddChild

func (n *ImplicitCastExpr) AddChild(node Node)

type ImplicitValueInitExpr added in v0.11.2

type ImplicitValueInitExpr struct {
	Address  string
	Position string
	Type1    string
	Type2    string
	Children []Node
}

func (*ImplicitValueInitExpr) AddChild added in v0.11.2

func (n *ImplicitValueInitExpr) AddChild(node Node)

type IncompleteArrayType added in v0.11.2

type IncompleteArrayType struct {
	Address  string
	Type     string
	Children []Node
}

func (*IncompleteArrayType) AddChild added in v0.11.2

func (n *IncompleteArrayType) AddChild(node Node)

type InitListExpr added in v0.11.2

type InitListExpr struct {
	Address  string
	Position string
	Type     string
	Children []Node
}

func (*InitListExpr) AddChild added in v0.11.2

func (n *InitListExpr) AddChild(node Node)

type IntegerLiteral

type IntegerLiteral struct {
	Address  string
	Position string
	Type     string
	Value    string
	Children []Node
}

func (*IntegerLiteral) AddChild

func (n *IntegerLiteral) AddChild(node Node)

type LabelStmt added in v0.11.2

type LabelStmt struct {
	Address  string
	Position string
	Name     string
	Children []Node
}

func (*LabelStmt) AddChild added in v0.11.2

func (n *LabelStmt) AddChild(node Node)

type MallocAttr

type MallocAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*MallocAttr) AddChild

func (n *MallocAttr) AddChild(node Node)

type MaxFieldAlignmentAttr added in v0.11.2

type MaxFieldAlignmentAttr struct {
	Address  string
	Position string
	Size     int
	Children []Node
}

func (*MaxFieldAlignmentAttr) AddChild added in v0.11.2

func (n *MaxFieldAlignmentAttr) AddChild(node Node)

type MemberExpr

type MemberExpr struct {
	Address  string
	Position string
	Type     string
	Lvalue   bool
	Name     string
	Address2 string
	Children []Node
}

func (*MemberExpr) AddChild

func (n *MemberExpr) AddChild(node Node)

type ModeAttr

type ModeAttr struct {
	Address  string
	Position string
	Name     string
	Children []Node
}

func (*ModeAttr) AddChild

func (n *ModeAttr) AddChild(node Node)

type NoInlineAttr added in v0.11.2

type NoInlineAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*NoInlineAttr) AddChild added in v0.11.2

func (n *NoInlineAttr) AddChild(node Node)

type NoThrowAttr

type NoThrowAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*NoThrowAttr) AddChild

func (n *NoThrowAttr) AddChild(node Node)

type Node

type Node interface {
	AddChild(node Node)
}

Node represents any node in the AST.

func Parse

func Parse(line string) Node

Parse takes the coloured output of the clang AST command and returns a root node for the AST.

type NonNullAttr

type NonNullAttr struct {
	Address  string
	Position string
	A        int
	B        int
	Children []Node
}

func (*NonNullAttr) AddChild

func (n *NonNullAttr) AddChild(node Node)

type OffsetOfExpr added in v0.11.2

type OffsetOfExpr struct {
	Address  string
	Position string
	Type     string
	Children []Node
}

func (*OffsetOfExpr) AddChild added in v0.11.2

func (n *OffsetOfExpr) AddChild(node Node)

type PackedAttr added in v0.11.2

type PackedAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*PackedAttr) AddChild added in v0.11.2

func (n *PackedAttr) AddChild(node Node)

type ParenExpr

type ParenExpr struct {
	Address  string
	Position string
	Type     string
	Children []Node
}

func (*ParenExpr) AddChild

func (n *ParenExpr) AddChild(node Node)

type ParenType added in v0.9.0

type ParenType struct {
	Address  string
	Type     string
	Sugar    bool
	Children []Node
}

func (*ParenType) AddChild added in v0.9.0

func (n *ParenType) AddChild(node Node)

type ParmVarDecl

type ParmVarDecl struct {
	Address   string
	Position  string
	Position2 string
	Name      string
	Type      string
	Type2     string
	IsUsed    bool
	Children  []Node
}

func (*ParmVarDecl) AddChild

func (n *ParmVarDecl) AddChild(node Node)

type PointerType

type PointerType struct {
	Address  string
	Type     string
	Children []Node
}

func (*PointerType) AddChild

func (n *PointerType) AddChild(node Node)

type PredefinedExpr

type PredefinedExpr struct {
	Address  string
	Position string
	Type     string
	Name     string
	Lvalue   bool
	Children []Node
}

func (*PredefinedExpr) AddChild

func (n *PredefinedExpr) AddChild(node Node)

type PureAttr added in v0.9.0

type PureAttr struct {
	Address   string
	Position  string
	Implicit  bool
	Inherited bool
	Children  []Node
}

func (*PureAttr) AddChild added in v0.9.0

func (n *PureAttr) AddChild(node Node)

type QualType

type QualType struct {
	Address  string
	Type     string
	Kind     string
	Children []Node
}

func (*QualType) AddChild

func (n *QualType) AddChild(node Node)

type Record

type Record struct {
	Address  string
	Type     string
	Children []Node
}

func (*Record) AddChild

func (n *Record) AddChild(node Node)

type RecordDecl

type RecordDecl struct {
	Address    string
	Position   string
	Prev       string
	Position2  string
	Kind       string
	Name       string
	Definition bool
	Children   []Node
}

func (*RecordDecl) AddChild

func (n *RecordDecl) AddChild(node Node)

type RecordType

type RecordType struct {
	Address  string
	Type     string
	Children []Node
}

func (*RecordType) AddChild

func (n *RecordType) AddChild(node Node)

type RestrictAttr

type RestrictAttr struct {
	Address  string
	Position string
	Name     string
	Children []Node
}

func (*RestrictAttr) AddChild

func (n *RestrictAttr) AddChild(node Node)

type ReturnStmt

type ReturnStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*ReturnStmt) AddChild

func (n *ReturnStmt) AddChild(node Node)

type ReturnsTwiceAttr added in v0.11.2

type ReturnsTwiceAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*ReturnsTwiceAttr) AddChild added in v0.11.2

func (n *ReturnsTwiceAttr) AddChild(node Node)

type StringLiteral

type StringLiteral struct {
	Address  string
	Position string
	Type     string
	Value    string
	Lvalue   bool
	Children []Node
}

func (*StringLiteral) AddChild

func (n *StringLiteral) AddChild(node Node)

type SwitchStmt added in v0.9.2

type SwitchStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*SwitchStmt) AddChild added in v0.9.2

func (n *SwitchStmt) AddChild(node Node)

type TranslationUnitDecl

type TranslationUnitDecl struct {
	Address  string
	Children []Node
}

func (*TranslationUnitDecl) AddChild

func (n *TranslationUnitDecl) AddChild(node Node)

type TransparentUnionAttr added in v0.9.0

type TransparentUnionAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*TransparentUnionAttr) AddChild added in v0.9.0

func (n *TransparentUnionAttr) AddChild(node Node)

type Typedef

type Typedef struct {
	Address  string
	Type     string
	Children []Node
}

func (*Typedef) AddChild

func (n *Typedef) AddChild(node Node)

type TypedefDecl

type TypedefDecl struct {
	Address      string
	Position     string
	Position2    string
	Name         string
	Type         string
	Type2        string
	IsImplicit   bool
	IsReferenced bool
	Children     []Node
}

func (*TypedefDecl) AddChild

func (n *TypedefDecl) AddChild(node Node)

type TypedefType

type TypedefType struct {
	Address  string
	Type     string
	Tags     string
	Children []Node
}

func (*TypedefType) AddChild

func (n *TypedefType) AddChild(node Node)

type UnaryExprOrTypeTraitExpr added in v0.11.0

type UnaryExprOrTypeTraitExpr struct {
	Address  string
	Position string
	Type1    string
	Function string
	Type2    string
	Children []Node
}

func (*UnaryExprOrTypeTraitExpr) AddChild added in v0.11.0

func (n *UnaryExprOrTypeTraitExpr) AddChild(node Node)

type UnaryOperator

type UnaryOperator struct {
	Address  string
	Position string
	Type     string
	IsLvalue bool
	IsPrefix bool
	Operator string
	Children []Node
}

func (*UnaryOperator) AddChild

func (n *UnaryOperator) AddChild(node Node)

type VAArgExpr added in v0.11.2

type VAArgExpr struct {
	Address  string
	Position string
	Type     string
	Children []Node
}

func (*VAArgExpr) AddChild added in v0.11.2

func (n *VAArgExpr) AddChild(node Node)

type VarDecl

type VarDecl struct {
	Address      string
	Position     string
	Position2    string
	Name         string
	Type         string
	Type2        string
	IsExtern     bool
	IsUsed       bool
	IsCInit      bool
	IsReferenced bool
	Children     []Node
}

func (*VarDecl) AddChild

func (n *VarDecl) AddChild(node Node)

type WarnUnusedResultAttr added in v0.9.0

type WarnUnusedResultAttr struct {
	Address  string
	Position string
	Children []Node
}

func (*WarnUnusedResultAttr) AddChild added in v0.9.0

func (n *WarnUnusedResultAttr) AddChild(node Node)

type WhileStmt

type WhileStmt struct {
	Address  string
	Position string
	Children []Node
}

func (*WhileStmt) AddChild

func (n *WhileStmt) AddChild(node Node)

Jump to

Keyboard shortcuts

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