Documentation ¶
Index ¶
- func GetOperators() []string
- func IsBalanced(phrase string) bool
- func IsStatement(phrase string) bool
- func Normalize(phrase string) string
- func SetOperators(values []string)
- func SplitSibling(phrase string) []string
- type Statement
- func (instance *Statement) Explain() string
- func (instance *Statement) HasChildren() bool
- func (instance *Statement) IsBlock() bool
- func (instance *Statement) IsBranch() bool
- func (instance *Statement) IsFirst() bool
- func (instance *Statement) IsLast() bool
- func (instance *Statement) IsLeaf() bool
- func (instance *Statement) String() string
- func (instance *Statement) WalkThrough(callback func(level, index int, statement *Statement))
- type StatementGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOperators ¶
func GetOperators() []string
func IsBalanced ¶
IsBalanced determines if a strings has balanced brackets
func IsStatement ¶
func SetOperators ¶
func SetOperators(values []string)
func SplitSibling ¶
SplitSibling get "A + (....) + B + (...)" and return ["A +", "(...)", "+ B", "(...)"]
Types ¶
type Statement ¶
type Statement struct { Uid string Text string Operator string Index int Count int Inner int // inner level Next []*Statement // on the right of statement }
func (*Statement) HasChildren ¶
func (*Statement) WalkThrough ¶
type StatementGroup ¶
type StatementGroup []*Statement
func ParseStatement ¶
func ParseStatement(text string) (*StatementGroup, error)
ParseStatement group statement into nested arrays @text "variable + variable - anothervariable"
func (*StatementGroup) Explain ¶
func (instance *StatementGroup) Explain() string
func (*StatementGroup) Parse ¶
func (instance *StatementGroup) Parse(text string) error
func (*StatementGroup) String ¶
func (instance *StatementGroup) String() string
func (*StatementGroup) WalkThrough ¶
func (instance *StatementGroup) WalkThrough(callback func(level, index int, statement *Statement))
Click to show internal directories.
Click to hide internal directories.