Documentation ¶
Overview ¶
The `expr` package implements a generic expression parser and evaluator, and interpolation for strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewParseError ¶
func NewPosError ¶
Types ¶
type BinaryFunction ¶
type BinaryFunction struct {
// contains filtered or unexported fields
}
func (*BinaryFunction) Kind ¶
func (n *BinaryFunction) Kind() TokenKind
func (*BinaryFunction) String ¶
func (n *BinaryFunction) String() string
type ExpressionListNode ¶
type ExpressionListNode struct {
// contains filtered or unexported fields
}
func (*ExpressionListNode) Kind ¶
func (n *ExpressionListNode) Kind() TokenKind
func (*ExpressionListNode) String ¶
func (n *ExpressionListNode) String() string
type FloatNumberNode ¶
type FloatNumberNode struct {
// contains filtered or unexported fields
}
FloatNumberNode is a node representing a number in unsigned float64 format
func (*FloatNumberNode) Kind ¶
func (n *FloatNumberNode) Kind() TokenKind
func (*FloatNumberNode) String ¶
func (n *FloatNumberNode) String() string
type IntNumberNode ¶
type IntNumberNode struct {
// contains filtered or unexported fields
}
IntNumberNode is a node representing a number in signed uint64 format
func (*IntNumberNode) Kind ¶
func (n *IntNumberNode) Kind() TokenKind
func (*IntNumberNode) String ¶
func (n *IntNumberNode) String() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents an expression parser
type Pos ¶
Pos marks the position within a context, like a file path. If path is nil then Pos is not used. Note that Line and Col are zero-indexed, so 1 needs to be added to them when printing.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner represents a lexical scanner.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type Token ¶
Token is decomposed from []byte stream to represent a kind of token and the vaoue of the token
func Interpolate ¶
Interpolation of a stream to return a set of tokens, some of which are strings, and some of which are expression tokens
type TokenKind ¶
type TokenKind uint
Classifies the kind of token
const ( Any TokenKind = iota String Expr Space Ident Number Punkt Question Colon Comma OpenParen CloseParen OpenSquare CloseSquare OpenBrace CloseBrace Ampersand Equal Less Greater Plus Minus Multiply Divide Not True False Null EOF // The following types are used for nodes only List Lowest = Equal // Lowest precedence )
type UintNumberNode ¶
type UintNumberNode struct {
// contains filtered or unexported fields
}
UintNumberNode is a node representing a number in unsigned uint64 format
func (*UintNumberNode) Kind ¶
func (n *UintNumberNode) Kind() TokenKind
func (*UintNumberNode) String ¶
func (n *UintNumberNode) String() string
type UnaryFunction ¶
type UnaryFunction struct {
// contains filtered or unexported fields
}
func (*UnaryFunction) Kind ¶
func (n *UnaryFunction) Kind() TokenKind
func (*UnaryFunction) String ¶
func (n *UnaryFunction) String() string