parser

package
v0.0.0-...-e229e0e Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: GPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFile

func ParseFile(path string, vert, frag, geo io.Writer) error

Types

type BinaryExpression

type BinaryExpression struct {
	Operator Token
	Left     Expression
	Right    Expression
}

func (BinaryExpression) Evaluate

func (b BinaryExpression) Evaluate(variables ...Variable) float64

type Expression

type Expression interface {
	Evaluate(variables ...Variable) float64
}

type Identifier

type Identifier struct {
	Name string
}

func (Identifier) Evaluate

func (i Identifier) Evaluate(variables ...Variable) float64

type Literal

type Literal struct {
	Value float64
}

func (Literal) Evaluate

func (l Literal) Evaluate(variables ...Variable) float64

type Parser

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

func New

func New(src io.Reader, path string, vert, frag, geo io.Writer) *Parser

func (*Parser) Parse

func (p *Parser) Parse()

type Token

type Token int
const (
	EOF Token
	WHITESPACE
	IDENTIFIER
	STRING
	NUMBER

	LEFT_PARENTHESIS  // (
	RIGHT_PARENTHESIS // )

	HASH      // #
	PLUS      // +
	MINUS     // -
	MULTIPLY  // *
	SLASH     // /
	REMAINDER // %
	POWER     // ^
	UNKNOWN

	// keywords
	INCLUDE
	VERT
	FRAG
	GEO
	ENDVERT
	ENDFRAG
	ENDGEO
	LOOKUP
)

type Variable

type Variable struct {
	Name  string
	Value float64
}

Jump to

Keyboard shortcuts

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