filter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AERC

type AERC struct {
	Value string `@"aerc"`
}

AERC represents the AERC variable type.

func (AERC) String

func (a AERC) String() string

type AmberControl

type AmberControl struct {
	Value string `@"a"`
}

AmberControl represents the amber control variable type.

func (AmberControl) String

func (a AmberControl) String() string

type And

type And struct {
	Value string `@"," | @"+"`
}

And represents the "and" operator between two expressions.

func (And) Eval

func (a And) Eval(s *Statement) string

Eval helps build up a string for the full statement.

func (And) String

func (a And) String() string

type ArtifactControl

type ArtifactControl struct {
	Value string `@"r"`
}

ArtifactControl represents the artifact control variable type.

func (ArtifactControl) String

func (a ArtifactControl) String() string

type BooleanOperator

type BooleanOperator interface {
	Eval(s *Statement) string
	String() string
}

BooleanOperator represents the operator that combines two expressions. Currently can be "and" or "or".

type Constraint

type Constraint struct {
	Var   Var    `@@`
	Op    *Op    `@@`
	Value *Value `@@`
}

Constraint represents a single constraint.

func (*Constraint) String

func (c *Constraint) String() string

type CreatureControl

type CreatureControl struct {
	Value string `@"c"`
}

CreatureControl represents the creature control variable type.

func (CreatureControl) String

func (c CreatureControl) String() string

type Disruption

type Disruption struct {
	Value string `@"d"`
}

Disruption represents the disruption variable type.

func (Disruption) String

func (e Disruption) String() string

type Efficiency

type Efficiency struct {
	Value string `@"f"`
}

Efficiency represents the efficiency variable type.

func (Efficiency) String

func (e Efficiency) String() string

type Expansion

type Expansion struct {
	Value string `@"expansion" | @"set"`
}

Expansion represents the expansion (or set) variable type.

func (Expansion) String

func (e Expansion) String() string

type ExpectedAmber

type ExpectedAmber struct {
	Value string `@"e"`
}

ExpectedAmber represents the expected amber variable type.

func (ExpectedAmber) String

func (a ExpectedAmber) String() string

type ExprChain

type ExprChain struct {
	Left    *Expression `@@`
	OpRight []*OpRight  `@@*`
}

ExprChain represents a full statement, which consists of at least one expression followed by zero or more other expressions combined with boolean operators.

func (*ExprChain) MakeTree

func (ec *ExprChain) MakeTree() *Node

MakeTree builds up a filter tree for the expression chain.

func (*ExprChain) String

func (ec *ExprChain) String() string

type Expression

type Expression struct {
	Constraint   *Constraint `@@`
	Substatement *Statement  `| "(" @@ ")"`
}

Expression is either a single constraint or a parenthetical statement.

func (*Expression) MakeTree

func (e *Expression) MakeTree() *Node

MakeTree builds up a filter tree for the expression.

func (*Expression) String

func (e *Expression) String() string

type House

type House struct {
	Value string `@"house"`
}

House represents the house variable type.

func (House) String

func (h House) String() string

type Node

type Node struct {
	Op    BooleanOperator
	Left  *Node
	Right *Node

	Constraint *Constraint
}

Node represents a node in the filter tree. It can either have a non-nil constraint (making it a leaf in the filter tree), or left and a right non-nil nodes combined with a boolean operator.

func Parse

func Parse(s string) (*Node, error)

Parse turns a string matching the above grammar into a filter tree.

func (*Node) String

func (n *Node) String() string

type Op

type Op struct {
	Equal bool `@"="?`
}

Op represent the operation specified by a constraint. Currently can only be equals.

type OpRight

type OpRight struct {
	Op    BooleanOperator `@@`
	Right *Statement      `@@`
}

OpRight represents the right side of an statement, including the operator.

func (*OpRight) String

func (or *OpRight) String() string

type Or

type Or struct {
	Value string `@"^"`
}

Or represents the "or" operator between two expressions.

func (Or) Eval

func (o Or) Eval(s *Statement) string

Eval helps build up a string for the full statement.

func (Or) String

func (o Or) String() string

type SAS

type SAS struct {
	Value string `@"sas"`
}

SAS represents the SAS variable type.

func (SAS) String

func (s SAS) String() string

type Statement

type Statement struct {
	Expr *ExprChain `@@`
}

Statement represents a statement specifying a full filter rule.

func (*Statement) MakeTree

func (s *Statement) MakeTree() *Node

MakeTree builds a filter tree for the statement.

func (*Statement) String

func (s *Statement) String() string

type Value

type Value struct {
	Range  []string `@(Float|Int)* @":" @(Float|Int)*`
	Float  *float64 `| @Float`
	Int    *int     `| @Int`
	String *string  `| @Ident`
}

Value represents the value of a constraint. Currently could be a range, float, int, or string.

func (*Value) MaxString

func (v *Value) MaxString() string

MaxString returns the maximum value for the range, if this value is a range.

func (*Value) MinString

func (v *Value) MinString() string

MinString returns the minimum value for the range, if this value is a range.

type Var

type Var interface {
	String() string
}

Var represents a variable type that is being constrained.

Jump to

Keyboard shortcuts

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