parse

package
v0.0.0-...-cfd4396 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsArrType

func IsArrType(t CType) bool

func IsCFuncType

func IsCFuncType(t CType) bool

func IsCharArr

func IsCharArr(t CType) bool

func IsCharType

func IsCharType(t CType) bool

func IsIntType

func IsIntType(t CType) bool

func IsPtrType

func IsPtrType(t CType) bool

func IsScalarType

func IsScalarType(t CType) bool

func IsSignedIntType

func IsSignedIntType(t CType) bool

func IsStructType

func IsStructType(t CType) bool

Types

type Array

type Array struct {
	MemberType CType
	Dim        int
}

type Binop

type Binop struct {
	Op   cpp.TokenKind
	Pos  cpp.FilePos
	L    Expr
	R    Expr
	Type CType
}

func (*Binop) GetPos

func (b *Binop) GetPos() cpp.FilePos

func (*Binop) GetType

func (b *Binop) GetType() CType

type Block

type Block struct {
	Pos  cpp.FilePos
	Body []Node
}

func (*Block) GetPos

func (b *Block) GetPos() cpp.FilePos

type CFunc

type CFunc struct {
	Name         string
	Pos          cpp.FilePos
	FuncType     *CFuncT
	ParamSymbols []*LSymbol
	Body         []Node
}

func (*CFunc) GetPos

func (f *CFunc) GetPos() cpp.FilePos

func (*CFunc) GetType

func (f *CFunc) GetType() CType

type CFuncT

type CFuncT struct {
	RetType  CType
	ArgTypes []CType
	ArgNames []string
	IsVarArg bool
}

type CStruct

type CStruct struct {
	Names   []string
	Types   []CType
	IsUnion bool
}

Struct or union.

func (*CStruct) FieldType

func (s *CStruct) FieldType(n string) CType

type CType

type CType interface{}

type Call

type Call struct {
	Pos      cpp.FilePos
	FuncLike Expr
	Args     []Expr
	Type     CType
}

func (*Call) GetPos

func (c *Call) GetPos() cpp.FilePos

func (*Call) GetType

func (c *Call) GetType() CType

type Cast

type Cast struct {
	Pos     cpp.FilePos
	Operand Expr
	Type    CType
}

func (*Cast) GetPos

func (c *Cast) GetPos() cpp.FilePos

func (*Cast) GetType

func (c *Cast) GetType() CType

type Constant

type Constant struct {
	Val  int64
	Pos  cpp.FilePos
	Type CType
}

func (*Constant) GetPos

func (c *Constant) GetPos() cpp.FilePos

func (*Constant) GetType

func (c *Constant) GetType() CType

type ConstantGPtr

type ConstantGPtr struct {
	Pos      cpp.FilePos
	PtrLabel string
	Offset   int64
	Type     CType
}

func (*ConstantGPtr) GetPos

func (c *ConstantGPtr) GetPos() cpp.FilePos

func (*ConstantGPtr) GetType

func (c *ConstantGPtr) GetType() CType

type DeclList

type DeclList struct {
	Pos     cpp.FilePos
	Storage SClass
	Symbols []Symbol
	Inits   []Expr
}

func (*DeclList) GetPos

func (d *DeclList) GetPos() cpp.FilePos

type DoWhile

type DoWhile struct {
	Pos    cpp.FilePos
	Cond   Node
	Body   Node
	LStart string
	LCond  string
	LEnd   string
}

func (*DoWhile) GetPos

func (d *DoWhile) GetPos() cpp.FilePos

type EmptyStmt

type EmptyStmt struct {
	Pos cpp.FilePos
}

func (*EmptyStmt) GetPos

func (e *EmptyStmt) GetPos() cpp.FilePos

type Expr

type Expr interface {
	Node
	GetType() CType
}

type ExprStmt

type ExprStmt struct {
	Pos  cpp.FilePos
	Expr Expr
}

func (*ExprStmt) GetPos

func (e *ExprStmt) GetPos() cpp.FilePos

type For

type For struct {
	Pos    cpp.FilePos
	Init   Node
	Cond   Node
	Step   Node
	Body   Node
	LStart string
	LEnd   string
}

func (*For) GetPos

func (f *For) GetPos() cpp.FilePos

type ForwardedType

type ForwardedType struct {
	Type CType
}

type GSymbol

type GSymbol struct {
	Label string
	Type  CType
}

type Goto

type Goto struct {
	IsBreak bool
	IsCont  bool
	Pos     cpp.FilePos
	Label   string
}

func (*Goto) GetPos

func (g *Goto) GetPos() cpp.FilePos

type Ident

type Ident struct {
	Pos cpp.FilePos
	Sym Symbol
}

func (*Ident) GetPos

func (i *Ident) GetPos() cpp.FilePos

func (*Ident) GetType

func (i *Ident) GetType() CType

type If

type If struct {
	Pos   cpp.FilePos
	Cond  Node
	Stmt  Node
	Else  Node
	LElse string
}

func (*If) GetPos

func (i *If) GetPos() cpp.FilePos

type Index

type Index struct {
	Pos  cpp.FilePos
	Arr  Node
	Idx  Node
	Type CType
}

func (*Index) GetPos

func (i *Index) GetPos() cpp.FilePos

func (*Index) GetType

func (i *Index) GetType() CType

type Initializer

type Initializer struct {
	Pos   cpp.FilePos
	Inits []Node
}

func (*Initializer) GetPos

func (i *Initializer) GetPos() cpp.FilePos

type LSymbol

type LSymbol struct {
	Type CType
}

type LabeledStmt

type LabeledStmt struct {
	Pos       cpp.FilePos
	AnonLabel string
	Label     string
	Stmt      Node
	IsCase    bool
	IsDefault bool
}

func (*LabeledStmt) GetPos

func (l *LabeledStmt) GetPos() cpp.FilePos

type Node

type Node interface {
	GetPos() cpp.FilePos
}

type Primitive

type Primitive int
const (
	CVoid Primitive = iota
	CEnum
	// Signed
	CChar
	CShort
	CInt
	CLong
	CLLong
	// Unsigned
	CBool
	CUChar
	CUShort
	CUInt
	CULong
	CULLong
	// Floats
	CFloat
	CDouble
	CLDouble
)

*NOTE* order is significant.

type Ptr

type Ptr struct {
	PointsTo CType
}

type Return

type Return struct {
	Pos cpp.FilePos
	Ret Expr
}

func (*Return) GetPos

func (r *Return) GetPos() cpp.FilePos

type SClass

type SClass int

Storage class

const (
	SC_AUTO SClass = iota
	SC_REGISTER
	SC_STATIC
	SC_TYPEDEF
	SC_GLOBAL
)

type Selector

type Selector struct {
	Op      cpp.TokenKind
	Pos     cpp.FilePos
	Type    CType
	Operand Expr
	Sel     string
}

func (*Selector) GetPos

func (s *Selector) GetPos() cpp.FilePos

func (*Selector) GetType

func (s *Selector) GetType() CType

type String

type String struct {
	Pos   cpp.FilePos
	Val   string
	Label string
}

func (*String) GetPos

func (s *String) GetPos() cpp.FilePos

func (*String) GetType

func (s *String) GetType() CType

type Switch

type Switch struct {
	Pos      cpp.FilePos
	Expr     Node
	Stmt     Node
	Cases    []SwitchCase
	LDefault string
	LAfter   string
}

func (*Switch) GetPos

func (sw *Switch) GetPos() cpp.FilePos

type SwitchCase

type SwitchCase struct {
	V     int64
	Label string
}

type Symbol

type Symbol interface{}

type TSymbol

type TSymbol struct {
	Type CType
}

type TargetSizeDesc

type TargetSizeDesc struct {
	GetSize  func(CType) int
	GetAlign func(CType) int
}

type TranslationUnit

type TranslationUnit struct {
	TopLevels      []Node
	AnonymousInits []Node
}

func Parse

func Parse(szdesc TargetSizeDesc, pp *cpp.Preprocessor) (tu *TranslationUnit, errRet error)

type Unop

type Unop struct {
	Op      cpp.TokenKind
	Pos     cpp.FilePos
	Operand Node
	Type    CType
}

func (*Unop) GetPos

func (u *Unop) GetPos() cpp.FilePos

func (*Unop) GetType

func (u *Unop) GetType() CType

type While

type While struct {
	Pos    cpp.FilePos
	Cond   Node
	Body   Node
	LStart string
	LEnd   string
}

func (*While) GetPos

func (w *While) GetPos() cpp.FilePos

Jump to

Keyboard shortcuts

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