gg_exp

package
v0.2.36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOperators

func GetOperators() []string

func IsBalanced

func IsBalanced(phrase string) bool

IsBalanced determines if a strings has balanced brackets

func IsStatement

func IsStatement(phrase string) bool

func Normalize

func Normalize(phrase string) string

func SetOperators

func SetOperators(values []string)

func SplitSibling

func SplitSibling(phrase string) []string

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) Explain

func (instance *Statement) Explain() string

func (*Statement) HasChildren

func (instance *Statement) HasChildren() bool

func (*Statement) IsBlock

func (instance *Statement) IsBlock() bool

IsBlock if true, this expression is self-contained in brackets

func (*Statement) IsBranch

func (instance *Statement) IsBranch() bool

IsBranch return true if the statement has at least one leaf

func (*Statement) IsFirst

func (instance *Statement) IsFirst() bool

func (*Statement) IsLast

func (instance *Statement) IsLast() bool

func (*Statement) IsLeaf

func (instance *Statement) IsLeaf() bool

func (*Statement) String

func (instance *Statement) String() string

func (*Statement) WalkThrough

func (instance *Statement) WalkThrough(callback func(level, index int, statement *Statement))

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))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL