Documentation ¶
Index ¶
- type Expr
- func (self *Expr) Add(v *Expr) *Expr
- func (self *Expr) And(v *Expr) *Expr
- func (self *Expr) Div(v *Expr) *Expr
- func (self *Expr) Evaluate() (int64, error)
- func (self *Expr) Free()
- func (self *Expr) Mod(v *Expr) *Expr
- func (self *Expr) Mul(v *Expr) *Expr
- func (self *Expr) Neg() *Expr
- func (self *Expr) Not() *Expr
- func (self *Expr) Or(v *Expr) *Expr
- func (self *Expr) Pow(v *Expr) *Expr
- func (self *Expr) Shl(v *Expr) *Expr
- func (self *Expr) Shr(v *Expr) *Expr
- func (self *Expr) Sub(v *Expr) *Expr
- func (self *Expr) Xor(v *Expr) *Expr
- type Operator
- type Parser
- type Repository
- type RuntimeError
- type SyntaxError
- type Term
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expr ¶
Expr represents an expression node.
func (*Expr) Evaluate ¶
Evaluate evaluates the expression into an integer. It also implements the Term interface.
type Operator ¶
type Operator uint8
Operator represents an operation to perform when Type is EXPR.
const ( // ADD performs "Add Expr.Left and Expr.Right". ADD Operator = iota // SUB performs "Subtract Expr.Left by Expr.Right". SUB // MUL performs "Multiply Expr.Left by Expr.Right". MUL // DIV performs "Divide Expr.Left by Expr.Right". DIV // MOD performs "Modulo Expr.Left by Expr.Right". MOD // AND performs "Bitwise AND Expr.Left and Expr.Right". AND // OR performs "Bitwise OR Expr.Left and Expr.Right". OR // XOR performs "Bitwise XOR Expr.Left and Expr.Right". XOR // SHL performs "Bitwise Shift Expr.Left to the Left by Expr.Right Bits". SHL // SHR performs "Bitwise Shift Expr.Left to the Right by Expr.Right Bits". SHR // POW performs "Raise Expr.Left to the power of Expr.Right" POW // NOT performs "Bitwise Invert Expr.Left". NOT // NEG performs "Negate Expr.Left". NEG )
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses an expression string to it's AST representation.
type Repository ¶
Repository represents a repository of Term's.
type RuntimeError ¶
type RuntimeError struct {
Reason string
}
RuntimeError is an error which would occure at run time.
func (*RuntimeError) Error ¶
func (self *RuntimeError) Error() string
type SyntaxError ¶
SyntaxError represents a syntax error in the expression.
func (*SyntaxError) Error ¶
func (self *SyntaxError) Error() string
Click to show internal directories.
Click to hide internal directories.