parser

package
v0.0.0-...-0feb360 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptimizeBinaryFunction

func OptimizeBinaryFunction(token *lex.Token, left *context.Node, right *context.Node, f BinaryFunction) (*context.Node, error)

OptimizeBinaryFunction will if both left and right nodes are constants return a constant node with the result of some function. If either are not constant then a new node will be created with the supplied handler attached.

func OptimizeUnaryFunction

func OptimizeUnaryFunction(token *lex.Token, left *context.Node, f UnaryFunction) (*context.Node, error)

OptimizeUnaryFunction will if the left node is a constant return a constant node with the result of some function. If it isn't a constant then a new node will be created with the supplied handler attached.

Types

type BinaryFunction

type BinaryFunction func(*context.Value, *context.Value) (*context.Value, error)

Function that performs an operation on two Values

type Parser

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

func NewParser

func NewParser(l *lex.Lexer) *Parser

func (*Parser) ParseExpression

func (p *Parser) ParseExpression() (*context.Node, error)

Top level for normal arithmetic

func (*Parser) ParseStatements

func (p *Parser) ParseStatements() (*context.Node, error)

type UnaryFunction

type UnaryFunction func(*context.Value) (*context.Value, error)

Function that performs an operation on one Value

Jump to

Keyboard shortcuts

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