parser

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOWEST int
	OR
	AND
	TERNARY
	RANGE
	EQUALS
	LESSGREATER
	SUM
	PRODUCT
	MODULO
	PREFIX
	CALL
	INDEX
)

The following list of constants define the available precedence levels.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser holds a slice of tokens, its position, and errors as well as the prefix, infix, and postfix parse functions.

func New

func New(scanner *scanner.Scanner) *Parser

New creates a new parser instance.

func (*Parser) Errors

func (parser *Parser) Errors() []string

Errors returns the slice of errors contained within the parser instance.

func (*Parser) Parse added in v0.18.0

func (parser *Parser) Parse() *ast.Program

Parse parses tokens and creates an AST. It returns the Program node, which holds a slice of Statements (and in turn, the rest of the tree).

Jump to

Keyboard shortcuts

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