operators

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_NONE operatorType = iota

	OP_DECLFUNC operatorType = iota
	OP_SEQUENCE operatorType = iota

	OP_ASSIGN       operatorType = iota
	OP_LOCALASSIGN  operatorType = iota
	OP_DECREMENT    operatorType = iota
	OP_INCREMENT    operatorType = iota
	OP_ASSIGNMUL    operatorType = iota
	OP_ASSIGNDIV    operatorType = iota
	OP_ASSIGNBITAND operatorType = iota
	OP_ASSIGNBITOR  operatorType = iota

	OP_ENUMERATE operatorType = iota

	OP_LOGICOR  operatorType = iota
	OP_LOGICAND operatorType = iota
	OP_EQUALITY operatorType = iota
	OP_NOTEQ    operatorType = iota

	OP_MORE   operatorType = iota
	OP_LESS   operatorType = iota
	OP_MOREEQ operatorType = iota
	OP_LESSEQ operatorType = iota

	OP_PLUS     operatorType = iota
	OP_MINUS    operatorType = iota
	OP_MULTIPLY operatorType = iota
	OP_DIVIDE   operatorType = iota
	OP_MODULO   operatorType = iota
	OP_POWER    operatorType = iota

	OP_BITOR      operatorType = iota
	OP_BITAND     operatorType = iota
	OP_BITXOR     operatorType = iota
	OP_BITCLEAR   operatorType = iota
	OP_BITINVERSE operatorType = iota
	OP_LEFTSHIFT  operatorType = iota
	OP_RIGHTSHIFT operatorType = iota

	OP_LOGICNOT operatorType = iota
	OP_POPCNT   operatorType = iota

	OP_LOCALVAR    operatorType = iota
	OP_USERVAR     operatorType = iota
	OP_CONSTANT    operatorType = iota
	OP_USERFUNC    operatorType = iota
	OP_BUILTINFUNC operatorType = iota

	OP_COUNT operatorType = iota
)

Operator types

Variables

This section is empty.

Functions

func Calculate

func Calculate(op *Operator, localVars map[string]interface{}) (interface{}, error)

Calculate operator tree and return final value.

Types

type Operator

type Operator struct {
	Type     operatorType
	OperandA *Operator
	OperandB *Operator
	Result   interface{}
}

func Generate

func Generate(words []utils.Word, localVars map[string]interface{}) (*Operator, error)

Generate operator tree from provided words.

Jump to

Keyboard shortcuts

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