parser

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package parser implements a hand-written recursive-descent parser that turns TDL source text into an ast.File. It collects every syntax error it finds in one pass rather than stopping at the first, so tooling like `tdl check` can report a complete list of problems.

The parser covers the whole grammar in docs/grammar.ebnf.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(filename string, r io.Reader) (*ast.File, error)

Parse reads and parses a single TDL source file. On success it returns the parsed ast.File; on failure it returns a nil file and an *ErrorList describing every syntax error found.

Types

type Error

type Error struct {
	Pos lex.Position
	Msg string
}

Error is a single parse error at a source position.

func (*Error) Error

func (e *Error) Error() string

type ErrorList

type ErrorList []*Error

ErrorList is a non-empty list of parse errors, returned by Parse when parsing fails. It reports every syntax error found in one pass rather than stopping at the first.

func (ErrorList) Error

func (el ErrorList) Error() string

Jump to

Keyboard shortcuts

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