parser

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSource

func ParseSource(filename string, src []byte, trace io.Writer) (res *ast.File, err error)

ParseSource parses source code 'src' and builds an AST.

Types

type Error

type Error struct {
	Pos source.FilePos
	Msg string
}

Error represents a parser error.

func (Error) Error

func (e Error) Error() string

type ErrorList

type ErrorList []*Error

ErrorList is a collection of parser errors.

func (*ErrorList) Add

func (p *ErrorList) Add(pos source.FilePos, msg string)

Add adds a new parser error to the collection.

func (ErrorList) Err

func (p ErrorList) Err() error

Err returns an error.

func (ErrorList) Error

func (p ErrorList) Error() string

func (ErrorList) Len

func (p ErrorList) Len() int

Len returns the number of elements in the collection.

func (ErrorList) Less

func (p ErrorList) Less(i, j int) bool

func (ErrorList) Sort

func (p ErrorList) Sort()

Sort sorts the collection.

func (ErrorList) Swap

func (p ErrorList) Swap(i, j int)

type Parser

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

Parser parses the Tengo source files.

func NewParser

func NewParser(file *source.File, src []byte, trace io.Writer) *Parser

NewParser creates a Parser.

func (*Parser) ParseFile

func (p *Parser) ParseFile() (file *ast.File, err error)

ParseFile parses the source and returns an AST file unit.

Jump to

Keyboard shortcuts

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