parser

package
v0.0.0-...-9a5373e Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package parser implements a parser used by the Elk interpreter.

Parser expects a slice of bytes containing Elk source code parses it, registering any encountered errors, and returns an Abstract Syntax Tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(sourceName string, source string) (*ast.ProgramNode, errors.ErrorList)

Parse the given source code and return an Abstract Syntax Tree. Main entry point to the parser.

Types

type Parser

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

Holds the current state of the parsing process.

func New

func New(sourceName string, source string) *Parser

Instantiate a new parser.

func (*Parser) IsIncomplete

func (p *Parser) IsIncomplete() bool

Returns true when the parser had finished early because of an END_OF_FILE token.

func (*Parser) Parse

func (p *Parser) Parse() (*ast.ProgramNode, errors.ErrorList)

Start the parsing process from the top.

func (*Parser) ShouldIndent

func (p *Parser) ShouldIndent() bool

Returns true when the parser had finished early because of an END_OF_FILE token and the following code should be indented.

Directories

Path Synopsis
Package ast defines types used by the Elk parser.
Package ast defines types used by the Elk parser.

Jump to

Keyboard shortcuts

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