calculator

package
v0.0.0-...-80c969b Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalculatorVisitor

type CalculatorVisitor struct {
	antlr.BaseParseTreeVisitor
	// contains filtered or unexported fields
}

func (*CalculatorVisitor) VisitExpression

func (v *CalculatorVisitor) VisitExpression(tree parser.IExpressionContext) Value

func (*CalculatorVisitor) VisitFactor

func (v *CalculatorVisitor) VisitFactor(tree parser.IFactorContext) Value

func (*CalculatorVisitor) VisitFunc

func (v *CalculatorVisitor) VisitFunc(tree parser.IFnContext) Value

func (*CalculatorVisitor) VisitNumber

func (v *CalculatorVisitor) VisitNumber(tree antlr.TerminalNode) float64

func (*CalculatorVisitor) VisitPrimary

func (v *CalculatorVisitor) VisitPrimary(tree parser.IPrimaryContext) Value

type Value

type Value struct {
	Number float64
	Unit   string
}

Value represents a number with an optional unit.

func AntlrEvaluate

func AntlrEvaluate(expression string) (Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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