Documentation ¶
Index ¶
- Constants
- func PrintExpr(w io.Writer, e Expr) error
- type AssignExpr
- type BinaryExpr
- type BinaryOp
- type CallExpr
- type CommaExpr
- type CondExpr
- type Expr
- type Ident
- type IdentExpr
- type IncDecExpr
- type IncDecOp
- type IndexExpr
- type Literal
- type LiteralKind
- type ParenExpr
- type SelectExpr
- type Type
- type UnaryExpr
- type UnaryOp
Constants ¶
const ( // LiteralInt is a kind for integer literals in C: 42, 0x42, etc. LiteralInt = LiteralKind(iota) // LiteralFloat is a kind for float/double literals: 1.0, 1e5, etc. LiteralFloat // LiteralChar is a kind for char literals: 'a', '\n', etc. LiteralChar // LiteralWChar is a kind for long/wide char literals: L'a'. LiteralWChar // LiteralString is a kind for string literals: "abc". LiteralString // LiteralString is a kind for long/wide string literals: L"abc". LiteralWString )
const ( // UnaryPlus is a plus operator in C: +x. UnaryPlus = UnaryOp(iota) // UnaryMinus is a minus operator in C: -x. UnaryMinus // UnaryInvert is a bit inversion operator in C: ~x. UnaryInvert // UnaryNot is a not operator in C: !x. UnaryNot // UnaryAddr is a take address operator in C: &x. UnaryAddr // UnaryDeref is a pointer dereference operator in C: *x. UnaryDeref )
const ( // BinaryNone is an fake C binary operator used in assign expressions: x = y. BinaryNone = BinaryOp(iota) // BinaryAdd is an addition operator in C: x + y. BinaryAdd // BinarySub is a subtraction operator in C: x - y. BinarySub // BinaryMul is a multiplication operator in C: x * y. BinaryMul // BinaryDiv is a division operator in C: x / y. BinaryDiv // BinaryMod is a modulo operator in C: x % y. BinaryMod // BinaryLsh is a binary left shift operator in C: x << y. BinaryLsh // BinaryRsh is a binary right shift operator in C: x >> y. BinaryRsh // BinaryEqual is an equality operator in C: x == y. BinaryEqual // BinaryNotEqual is an inequality operator in C: x != y. BinaryNotEqual // BinaryLess is a less than operator in C: x < y. BinaryLess // BinaryGreater is a greater than operator in C: x > y. BinaryGreater // BinaryLessEqual is a less than or equal operator in C: x <= y. BinaryLessEqual // BinaryGreaterEqual is a greater than or equal operator in C: x >= y. BinaryGreaterEqual // BinaryAnd is a logical and operator in C: x && y. BinaryAnd // BinaryOr is a logical or operator in C: x || y. BinaryOr // BinaryBitAnd is a bit and operator in C: x & y. BinaryBitAnd // BinaryBitOr is a bit or operator in C: x | y. BinaryBitOr // BinaryBitXOr is a exclusive bit or operator in C: x ^ y. BinaryBitXOr )
const ( // IncPost is a postfix increment operator in C: x++. IncPost = IncDecOp(iota) // DecPost is a postfix decrement operator in C: x--. DecPost // IncPre is a prefix increment operator in C: ++x. IncPre // DecPre is a prefix decrement operator in C: --x. DecPre )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssignExpr ¶
AssignExpr is an assignment expression in C: x = y, x += y, etc. It returns a value that was assigned, allowing chaining assignments: x = y = z.
type BinaryExpr ¶
BinaryExpr is a binary expression in C: x + y, x == y, etc.
type CommaExpr ¶
type CommaExpr []Expr
CommaExpr is a comma expression in C: x1, x2, ..., xN. It evaluates all expressions in order and returns the result of the last one only. Other results are discarded.
type CondExpr ¶
CondExpr is a conditional expression in C: x ? y : z. If condition evaluates to true, "then" expression is returned. Otherwise, the "else" expression is returned.
type Expr ¶
type Expr interface { // Type returns a type of an expression. Type() Type // contains filtered or unexported methods }
Expr is an interface type for C expressions.
func NewExprFrom ¶
func NewExprFrom(n cc.Node) Expr
NewExprFrom creates an Expr node from a CC AST node (*cc.Expression, *cc.PrimaryExpression, etc).
type Ident ¶
type Ident struct { Name string // contains filtered or unexported fields }
Ident is an identifier in C.
type IncDecExpr ¶
IncDecExpr is an increment/decrement expression in C: x++, ++x, x--, etc. Prefix operators first increment the value and return a modified one, while postfix variant return an old value and then increment the value.
type IndexExpr ¶
IndexExpr is an index expression in C: x[y]. The left operand should be either an array or a pointer.
type Literal ¶
type Literal struct {
// contains filtered or unexported fields
}
Literal is a constant literal expression in C. See LiteralKind for details on specific kinds.
type ParenExpr ¶
type ParenExpr struct {
X Expr
}
ParenExpr is a parentheses expression in C: (x). It returns the expression value without changes. Used primarily to control evaluation order in binary expressions.
type SelectExpr ¶
SelectExpr is field select expression in C: x.y, x->y.