parse

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const COMMENT_CHARS = "#"
View Source
const VARIABLE_END = "}}"
View Source
const VARIABLE_START = "${{"

Variables

This section is empty.

Functions

func FirstNonWhitespaceIndex

func FirstNonWhitespaceIndex(line string) int

Get the index of the first non-whitespace character. Returns -1 if the line is empty or all whitespace.

func IndentLevel

func IndentLevel(line string) int

func ParseSupermakeFile added in v0.0.4

func ParseSupermakeFile(cwd, path string) (*supermake.SupermakeFile, error)

func ParseSupermakeString

func ParseSupermakeString(cwd, data string) (*supermake.SupermakeFile, error)

func ReplaceVariables

func ReplaceVariables(s string, f func(v string) (string, error)) (string, error)

Replace every variable with the return value of f. Supports nested variables, such that variable references may be constructed out of variables themselves. E.g. if X=A, Y=B, A-B=test, $($(X)-$(Y)) becomes 'test'. Errors returned by f are propagated to the function return value.

Types

type LineType

type LineType int
const (
	VARIABLE LineType = iota
	TARGET
	EXECUTOR
	COMMAND
)

type SuperMakeFileParser

type SuperMakeFileParser struct {
	Variables supermake.Variables
	// contains filtered or unexported fields
}

func NewParser

func NewParser(lines []string) *SuperMakeFileParser

func (*SuperMakeFileParser) Parse

Jump to

Keyboard shortcuts

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