parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// WARNING indicates a mistake that might affect correctness
	WARNING

	// ERROR indicates a mistake that prevents execution of any workflows in the file
	ERROR

	// FATAL indicates a mistake that prevents even drawing the file
	FATAL
)

Variables

This section is empty.

Functions

func Parse

func Parse(reader io.Reader, options ...OptionFunc) (*model.Configuration, error)

Parse parses a .workflow file and return the actions and global variables found within.

Types

type Error

type Error struct {
	Errors    []*ParseError
	Actions   []*model.Action
	Workflows []*model.Workflow
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) FirstError

func (e *Error) FirstError(severity Severity) error

FirstError searches a Configuration for the first error at or above a given severity level. Checking the return value against nil is a good way to see if the file has any errors at or above the given severity. A caller intending to execute the file might check for `errors.FirstError(parser.WARNING)`, while a caller intending to display the file might check for `errors.FirstError(parser.FATAL)`.

type ErrorPos

type ErrorPos struct {
	File   string
	Line   int
	Column int
}

ErrorPos represents the location of an error in a user's workflow file(s).

type OptionFunc

type OptionFunc func(*Parser)

func WithSuppressErrors

func WithSuppressErrors() OptionFunc

func WithSuppressWarnings

func WithSuppressWarnings() OptionFunc

type ParseError

type ParseError struct {
	Pos      ErrorPos
	Severity Severity
	// contains filtered or unexported fields
}

ParseError represents an error identified by the parser, either syntactic (HCL) or semantic (.workflow) in nature. There are fields for location (File, Line, Column), severity, and base error string. The `Error()` function on this type concatenates whatever bits of the location are available with the message. The severity is only used for filtering.

func (*ParseError) Error

func (e *ParseError) Error() string

type Parser

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

type Severity

type Severity int

Severity represents the level of an error encountered while parsing a workflow file. See the comments for WARNING, ERROR, and FATAL, above.

Jump to

Keyboard shortcuts

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