mparser

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseExpr

func ParseExpr(code string, mode Mode) (expr ast.Expr, err error)

ParseExpr parses an expression

func ParseLine

func ParseLine(code string, mode Mode) (stmts []ast.Stmt, err error)

ParseLine parses a line of code that could contain one or more statements

Types

type Mode

type Mode uint

A Mode value is a set of flags (or 0). They control the amount of source code parsed and other optional parser functionality.

const (
	ParseComments     Mode             = 1 << iota // parse comments and add them to AST
	Trace                                          // print a trace of parsed productions
	DeclarationErrors                              // report declaration errors
	SpuriousErrors                                 // same as AllErrors, for backward-compatibility
	AllErrors         = SpuriousErrors             // report all errors (not just the first 10 on different lines)
)