parser

package
v6.7.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorLexEOF = errors.New("lex source EOF")
)

Functions

func Calc

func Calc(s string, data map[string]float64) bool

func MathCalc

func MathCalc(s string, data map[string]float64) (float64, error)

Types

type BinaryNode

type BinaryNode struct {
	Type  TokenType
	Left  Node
	Right Node
}

type IdentifierNode

type IdentifierNode struct {
	Lit string
}

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

type Node

type Node interface {
}

type NumberNode

type NumberNode struct {
	Type TokenType
	Lit  string
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(buf []rune) *Parser

func (*Parser) Err

func (p *Parser) Err() error

func (*Parser) Parse

func (p *Parser) Parse() error

func (*Parser) PrintAST

func (p *Parser) PrintAST()

func (*Parser) Stats

func (p *Parser) Stats() []Node

type Token

type Token struct {
	// contains filtered or unexported fields
}

func (*Token) String

func (t *Token) String() string

type TokenType

type TokenType int
const (
	EOF TokenType = iota
	AND
	OR
	EXP

	Identifier

	GT
	GE
	LT
	LE
	EQ
	NE

	Plus
	Minus
	Star
	Slash
	LeftParen
	RightParen

	IntLiteral
	UintLiteral
	FloatLiteral
)

func (TokenType) String

func (t TokenType) String() string

Jump to

Keyboard shortcuts

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