ast

package
v0.8.17 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TargetBase = "base"

Variables

This section is empty.

Functions

func IsValidEnvVarName

func IsValidEnvVarName(name string) bool

IsValidEnvVarName returns true if env name is valid.

func Parse

func Parse(filePath string, enableSourceMap bool) (ef spec.Earthfile, err error)

Parse parses an earthfile into an AST.

func ParseOpts

func ParseOpts(from FromOpt, opts ...Opt) (spec.Earthfile, error)

ParseOpts parses an earthfile into an AST. This is the functional option version, which uses option functions to change how a file is parsed.

func ParseVersion

func ParseVersion(filePath string, enableSourceMap bool) (*spec.Version, error)

ParseVersion reads the VERSION command for an Earthfile and returns spec.Version.

func ParseVersionOpts

func ParseVersionOpts(fromOpt FromOpt, opts ...Opt) (*spec.Version, error)

ParseVersionOpts reads the VERSION command for an Earthfile and returns a spec.Version. This is the functional option version, which uses options to change how a file is parsed.

Types

type FromOpt

type FromOpt func(prefs) (prefs, error)

FromOpt is an option function for customizing the source reader of ParseVersion.

func FromPath

func FromPath(path string) FromOpt

FromPath tells ParseVersion to open and read from a file at path.

func FromReader

func FromReader(r NamedReader) FromOpt

FromReader tells ParseVersion to read from reader.

type NamedReader

type NamedReader interface {
	Name() string
	Seek(offset int64, whence int) (int64, error)
	Read(buff []byte) (n int, err error)
}

NamedReader is simply an io.Reader with a name. It matches os.File, but allows non-file types to be passed in.

type Opt

type Opt func(prefs) (prefs, error)

Opt is an option function for customizing the behavior of ParseVersion.

func WithSourceMap

func WithSourceMap() Opt

WithSourceMap tells ParseVersion to enable a source map when parsing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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