errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParseContext

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

A ParseContext contains error information about a parsing activity.

func NewParseContext

func NewParseContext() *ParseContext

NewParseContext creates a new context.

func (*ParseContext) AddFunctionError

func (c *ParseContext) AddFunctionError(pos ast.Position, format string, args ...interface{})

AddFunctionError adds a new error relating to function parsing.

func (*ParseContext) AddTypeError

func (c *ParseContext) AddTypeError(pos ast.Position, format string, args ...interface{})

AddTypeError adds a new error relating to type parsing.

func (*ParseContext) FunctionErrors

func (c *ParseContext) FunctionErrors() []SourceError

FunctionErrors returns the function errors (possibly empty).

func (*ParseContext) HasErrors

func (c *ParseContext) HasErrors(mark int) bool

HasErrors returns true if an error has been recorded since the Mark was called.

func (*ParseContext) Mark

func (c *ParseContext) Mark() (mark int)

Mark provides an opaque reference to the current context. Later, this reference can be used in HasErrors to determine if the context has changed.

func (*ParseContext) TypeErrors

func (c *ParseContext) TypeErrors() []SourceError

TypeErrors returns the type errors (possibly empty).

type SourceError

type SourceError struct {
	Pos     ast.Position
	Message string
}

A SourceError contains information about where an error occurred when parsing source code

func NewSourceError

func NewSourceError(pos ast.Position, format string, args ...interface{}) SourceError

NewSourceError creates a new SourceError. Pass an empty ast.Position if source information is not available.

func (SourceError) Error

func (s SourceError) Error() string

Jump to

Keyboard shortcuts

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