Documentation
¶
Index ¶
Constants ¶
const ( NIL token = iota OP LEAF )
Define valid token types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Leaf ¶
type Leaf struct {
Val uint
}
Leaf is a concrete Node that will hold a single value
type Node ¶
Node is our interface and represents a node in a binary expression tree.
func Parse ¶
Parse will take a logic string (e.g. "1 AND 2 OR (3 AND 4)"), parse it and turn it into a binary expression tree.
func Sequence ¶
Sequence will walk all of the leaves and re-sequence the values, starting at 0 and removing sparseness
func WalkLeaves ¶
WalkLeaves will visit every leaf and run the Visitor action on each
type Op ¶
Op is a concrete Node that will hold an operation with pointers to a left and right node, both of which can be a Leaf or another Op
type ParseError ¶
ParseError holds information about syntactic errors when trying to eval
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type SerializeError ¶
SerializeError holds information about syntactic errors when trying to eval
func (*SerializeError) Error ¶
func (e *SerializeError) Error() string