parser

package
v0.101.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 9 Imported by: 12

Documentation

Overview

Package parser implements a parser for Flux source files. Input is provided by a string and output is an abstract-syntax tree (AST) representing the Flux source.

The parser accepts a larger language than is syntactically permitted and will embed any errors from parsing the source into the AST itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleToJSON added in v0.68.0

func HandleToJSON(hdl flux.ASTHandle) ([]byte, error)

func MustParseTime added in v0.21.0

func MustParseTime(lit string) *ast.DateTimeLiteral

MustParseTime parses a time literal and panics in the case of an error.

func ParseDir added in v0.13.0

func ParseDir(fset *token.FileSet, path string) (map[string]*ast.Package, error)

ParseDir parses all files ending in '.flux' within the specified directory. All discovered packages are returned. The parsed packages may contain errors, use ast.Check to check for errors.

func ParseDuration added in v0.21.0

func ParseDuration(lit string) (*ast.DurationLiteral, error)

ParseDuration will convert a string into an DurationLiteral.

func ParseFile

func ParseFile(fset *token.FileSet, path string) (*ast.File, error)

ParseFile parses the specified path as a Flux source file. The parsed file may contain errors, use ast.Check to check for errors.

func ParseSignedDuration added in v0.23.0

func ParseSignedDuration(lit string) (*ast.DurationLiteral, error)

ParseSignedDuration will convert a string into a possibly negative DurationLiteral.

func ParseSource added in v0.13.0

func ParseSource(source string) *ast.Package

ParseSource parses the string as Flux source code. The parsed package may contain errors, use ast.Check to check for errors.

func ParseString added in v0.21.0

func ParseString(lit string) (*ast.StringLiteral, error)

ParseString removes quotes and unescapes the string literal.

func ParseTime added in v0.21.0

func ParseTime(lit string) (*ast.DateTimeLiteral, error)

ParseTime will convert a string into an *ast.DateTimeLiteral.

func ParseToHandle added in v0.68.0

func ParseToHandle(src []byte) (*libflux.ASTPkg, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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