Help us shape the future of Go! Take the 2026 Go Developer Survey

parser

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOWEST_PRECEDENCE = 0
	LOWEST            = 1
	WALRUS_EXPR       = 2 // := binds looser than everything except another :=
	CONDITIONAL       = 3 // for conditional expressions (x if cond else y)
	OR                = 4
	AND               = 5
	NOT_EXPR          = 6 // prefix `not`: tighter than and/or, looser than comparisons
	// Comparisons share one level, as in Python (==, !=, <, >, <=, >=, in,
	// is): mixed chains like a < b == c are built by parseInfixExpression.
	EQUALS      = 7
	LESSGREATER = 7
	BIT_OR      = 8
	BIT_XOR     = 9
	BIT_AND     = 10
	BIT_SHIFT   = 11
	SUM         = 12
	PRODUCT     = 13
	POWER       = 14
	PREFIX      = 15
	CALL        = 16
)

Variables

This section is empty.

Functions

func ParseExpressionString added in v0.29.0

func ParseExpressionString(input string) ast.Expression

ParseExpressionString parses a standalone expression, for callers that evaluate text assembled at runtime (f-string nested format fields). Returns nil for invalid input.

Types

type Parser

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

func New

func New(l *lexer.Lexer) *Parser

func (*Parser) Errors

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

func (*Parser) ParseProgram

func (p *Parser) ParseProgram() *ast.Program

func (*Parser) Reset added in v0.5.6

func (p *Parser) Reset(l *lexer.Lexer)

Jump to

Keyboard shortcuts

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