parser

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLazyCommand

func IsLazyCommand(line string) bool

func ParseAndExecuteExpr

func ParseAndExecuteExpr(expr string, attrs map[string]interface{}) (interface{}, error)

ParseAndExecuteExpr parse and execute expr

func ParseExpr

func ParseExpr(expr string) (ast.Expr, error)

ParseExpr is a convenience function for obtaining the AST of an expression x.

Types

type Command

type Command struct {
	ValCommand   []VarCommand
	IfCommand    []IfCommand
	RangeCommand []RangeCommand
}

func ParseLazyCommand

func ParseLazyCommand(line string) (command Command, err error)

type IfCommand

type IfCommand struct {
	Expr  string // judgment condition
	Scope int    // affected scope
}

type RangeAction

type RangeAction struct {
	Target string // replace the content
	Value  string // current slot value
}

type RangeCommand

type RangeCommand struct {
	Expr    string // judgment condition
	Scope   int    // affected scope
	Loop    int
	TagId   int // slot tag id
	Counter int
	Action  [][][]RangeAction
}

func ParseAndExecuteRangeExpr

func ParseAndExecuteRangeExpr(order RangeCommand, attrs map[string]interface{}) (RangeCommand, error)

ParseAndExecuteRangeExpr parse and execute range expr

type VarCommand

type VarCommand struct {
	Variable string // variable
	Target   string // replace the content
	Scope    int    // affected scope
}

Jump to

Keyboard shortcuts

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