parser

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParse = errors.New("parse error")

Functions

This section is empty.

Types

type Parser

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

func NewParser

func NewParser(input io.Reader, filename string) *Parser

NewParser creates a new parser

func NewParserFromString

func NewParserFromString(input, filename string) *Parser

NewParserFromString creates a new parser from a string (convenience function)

func (*Parser) ParseProgram

func (p *Parser) ParseProgram(ctx context.Context) (*ast.Program, error)

type Precedence

type Precedence uint8

Precedence levels for Pratt parser

const (
	LOWEST     Precedence = iota
	PIPELINE              // |>
	TERNARY               // ? :
	OR                    // or
	XOR                   // xor
	AND                   // and
	EQUALITY              // == != is
	COMPARISON            // > < >= <= matches contains in
	SUM                   // + -
	PRODUCT               // * / %
	UNARY                 // !x -x +x not
	CALL                  // myFunction(X)
	INDEX                 // array[index], obj.field
	PRIMARY               // base precedence for primary expressions
)

type Program

type Program struct {
	Statements []ast.Statement
}

Jump to

Keyboard shortcuts

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