parser

package
v0.0.0-...-3b5741d Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(e error, colored, inclSource bool) string

FormatError is a utility function that takes advantage of the metadata stored in the errors returned by this package's parser.

If the second argument `colored` is true, the error message is colorized. If the third argument `inclSource` is true, the error message will contain snippets of the YAML source that was used.

func Parse

func Parse(tokens token.Tokens, mode Mode) (*ast.File, error)

Parse parse from token instances, and returns ast.File

func ParseBytes

func ParseBytes(bytes []byte, mode Mode) (*ast.File, error)

ParseBytes parse from byte slice, and returns ast.File

func ParseFile

func ParseFile(filename string, mode Mode) (*ast.File, error)

Parse parse from filename, and returns ast.File

Types

type Mode

type Mode uint
const (
	ParseComments Mode = 1 << iota // parse comments and add them to AST
)

type Pos

type Pos int

Pos represents a byte position in the original input text from which this template was parsed.

func (Pos) Position

func (p Pos) Position() Pos

Jump to

Keyboard shortcuts

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