...

Package parse

import "github.com/drone/envsubst/v2/parse"
Overview
Index

Overview ▾

Variables

var (
    // ErrBadSubstitution represents a substitution parsing error.
    ErrBadSubstitution = errors.New("bad substitution")

    // ErrMissingClosingBrace represents a missing closing brace "}" error.
    ErrMissingClosingBrace = errors.New("missing closing brace")

    // ErrParseVariableName represents the error when unable to parse a
    // variable name within a substitution.
    ErrParseVariableName = errors.New("unable to parse variable name")

    // ErrParseFuncSubstitution represents the error when unable to parse the
    // substitution within a function parameter.
    ErrParseFuncSubstitution = errors.New("unable to parse substitution within function")

    // ErrParseDefaultFunction represent the error when unable to parse a
    // default function.
    ErrParseDefaultFunction = errors.New("unable to parse default function")
)

type FuncNode

FuncNode represents a string function.

type FuncNode struct {
    Param string
    Name  string
    Args  []Node
}

type ListNode

ListNode represents a list of nodes.

type ListNode struct {
    Nodes []Node
}

type Node

Node is an element in the parse tree.

type Node interface {
    // contains filtered or unexported methods
}

type TextNode

TextNode represents a string of text.

type TextNode struct {
    Value string
}

type Tree

Tree is the representation of a single parsed SQL statement.

type Tree struct {
    Root Node
    // contains filtered or unexported fields
}

func Parse

func Parse(buf string) (*Tree, error)

Parse parses the string and returns a Tree.

func (*Tree) Parse

func (t *Tree) Parse(buf string) (tree *Tree, err error)

Parse parses the string buffer to construct an ast representation for expansion.