parser

package
v0.26.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package parser implements utilities for parsing River configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseExpression

func ParseExpression(expr string) (ast.Expr, error)

ParseExpression parses a single River expression from expr.

If an error was encountered during parsing, the returned expression will be nil and err will be an ErrorList with all the errors encountered during parsing.

func ParseFile

func ParseFile(filename string, data []byte) (*ast.File, error)

ParseFile parses an entire River configuration file. The data parameter should hold the file contents to parse, while the filename parameter is used for reporting errors.

If an error was encountered during parsing, the returned AST will be nil and err will be an ErrorList with all the errors encountered during parsing.

Types

type Error

type Error struct {
	Position token.Position
	Message  string
}

Error is an error encountered during parsing.

func (Error) Error

func (e Error) Error() string

Error implements error.

type ErrorList

type ErrorList []*Error

ErrorList is a list of Error.

func (*ErrorList) Add

func (l *ErrorList) Add(e *Error)

Add appends a new error into the ErrorList.

func (ErrorList) Error

func (l ErrorList) Error() string

Error implements error.

Jump to

Keyboard shortcuts

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