math

package
v0.0.0-...-e1c98eb Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const OperatorAdd = "+"
View Source
const OperatorDiv = "/"
View Source
const OperatorMul = "*"
View Source
const OperatorSub = "-"
View Source
const T_EOF string = "T_EOF"
View Source
const T_LCLOSURE_MARK string = "T_LCLOSURE_MARK"
View Source
const T_NUMBER_MARK string = "T_NUMBER_MARK"
View Source
const T_OPER_MARK string = "T_OPER_MARK"
View Source
const T_RCLOSURE_MARK string = "T_RCLOSURE_MARK"
View Source
const T_VAR_MARK string = "T_VAR_MARK"

Variables

View Source
var EOF string = "+++EOF+++"

EOF character

Functions

This section is empty.

Types

type Item

type Item interface {
	Int([]int) int
	Float([]int) float64

	BeClosure()

	String() string
	// contains filtered or unexported methods
}

func Parse

func Parse(tokens []LexToken) Item

Parse creates a new parser with the recommended parameters.

type LexToken

type LexToken [3]string

LexToken holds is a (type, value) array.

func Lexer

func Lexer(input string) (*lexer, []LexToken)

Lexer creates a new scanner for the input string.

type NumberItem

type NumberItem struct {
	Number interface{}
}

func (*NumberItem) BeClosure

func (n *NumberItem) BeClosure()

func (*NumberItem) Float

func (n *NumberItem) Float(vars []int) float64

func (*NumberItem) Int

func (n *NumberItem) Int(vars []int) int

func (*NumberItem) String

func (n *NumberItem) String() string

type OperationItem

type OperationItem struct {
	FirstItem  Item
	Operator   Operator
	SecondItem Item
	// contains filtered or unexported fields
}

func (*OperationItem) BeClosure

func (i *OperationItem) BeClosure()

func (*OperationItem) Float

func (i *OperationItem) Float(vars []int) float64

func (*OperationItem) Int

func (i *OperationItem) Int(vars []int) int

func (*OperationItem) String

func (i *OperationItem) String() string

type Operator

type Operator string

func (Operator) GreatThan

func (o Operator) GreatThan(p Operator) bool

type VarItem

type VarItem struct {
	Serial int
}

func (*VarItem) BeClosure

func (v *VarItem) BeClosure()

func (*VarItem) Float

func (v *VarItem) Float(vars []int) float64

func (*VarItem) Int

func (v *VarItem) Int(vars []int) int

func (*VarItem) String

func (v *VarItem) String() string

Jump to

Keyboard shortcuts

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