ast

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LanguageNode

type LanguageNode interface {
	SubstituteVars(map[string]interface{}) error
	Evaluate() string
}

LanguageNode represents a node in the AST.

type SyntaxTree

type SyntaxTree struct {
	// contains filtered or unexported fields
}

SyntaxTree is a concrete implementation of the AST.

func (*SyntaxTree) Evaluate

func (t *SyntaxTree) Evaluate() string

Evaluate returns the recursively evaluated SyntaxTree.

func (*SyntaxTree) SubstituteVars

func (t *SyntaxTree) SubstituteVars(vars map[string]interface{}) error

SubstituteVars performs recursive vars substitution on the SyntaxTree.

type TokenTree

type TokenTree struct {
	// contains filtered or unexported fields
}

TokenTree represents a tree of token chunks.

func BuildTokenTree

func BuildTokenTree(q string) *TokenTree

BuildTokenTree builds a tree of tokens from a template string.

func (*TokenTree) Parse

func (tt *TokenTree) Parse() (LanguageNode, error)

Parse parses the TokenTree and returns the AST built from it.

Jump to

Keyboard shortcuts

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