Documentation ¶
Overview ¶
Package builtins contains utilities for implementing built-in functions.
Index ¶
- func FloatToNumber(f *big.Float) ast.Number
- func IntOperand(x ast.Value, pos int) (int, error)
- func NewOperandElementErr(pos int, composite ast.Value, got ast.Value, expected ...string) error
- func NewOperandEnumErr(pos int, expected ...string) error
- func NewOperandErr(pos int, f string, a ...interface{}) error
- func NewOperandTypeErr(pos int, got ast.Value, expected ...string) error
- func NumberOperand(x ast.Value, pos int) (ast.Number, error)
- func NumberToFloat(n ast.Number) *big.Float
- func SetOperand(x ast.Value, pos int) (*ast.Set, error)
- func StringOperand(x ast.Value, pos int) (ast.String, error)
- type ErrOperand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FloatToNumber ¶
FloatToNumber converts f to a number.
func IntOperand ¶
IntOperand converts x to an int. If the cast fails, a descriptive error is returned.
func NewOperandElementErr ¶
NewOperandElementErr returns an operand error indicating an element in the composite operand was wrong.
func NewOperandEnumErr ¶
NewOperandEnumErr returns an operand error indicating a value was wrong.
func NewOperandErr ¶
NewOperandErr returns a generic operand error.
func NewOperandTypeErr ¶
NewOperandTypeErr returns an operand error indicating the operand's type was wrong.
func NumberOperand ¶
NumberOperand converts x to a number. If the cast fails, a descriptive error is returned.
func NumberToFloat ¶
NumberToFloat converts n to a big float.
func SetOperand ¶
SetOperand converts x to a set. If the cast fails, a descriptive error is returned.
Types ¶
type ErrOperand ¶
type ErrOperand string
ErrOperand represents an invalid operand has been passed to a built-in function. Built-ins should return ErrOperand to indicate a type error has occurred.
func (ErrOperand) Error ¶
func (err ErrOperand) Error() string