Documentation
¶
Overview ¶
* Package for goats-html expression language. * * Supported expressions: * - go-expr * - go-expr if (condition) * - go-expr if (condition) else go-expr * - go-expr if (condition) elif (condition) go-expr elif (condition) go-expr * - go-expr if (condition) elif (condition) elif (condition) go-expr else go-expr
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExprHandler ¶
ExprHandler represents any object which can rewrite an expression according to certain rules.
func NewExprRewriter ¶ added in v0.3.0
func NewExprRewriter(symMgr *symbolmgr.SymbolMgr, pkgRefs pkgmgr.AliasReferer, format string) ExprHandler
NewExprRewriter creates a new ExprRewriter for the given target format.
type ExprParser ¶
type ExprParser struct {
// contains filtered or unexported fields
}
func NewExprParser ¶
func NewExprParser(eh ExprHandler) *ExprParser
func (*ExprParser) Evaluate ¶
func (ep *ExprParser) Evaluate(src string, w io.Writer, callback OnEvalExpr)
type ExprRewriter ¶ added in v0.3.0
type ExprRewriter struct {
// contains filtered or unexported fields
}
ExprRewriter parses an input expression and rewrite it according to the target lauguage format: - convert snake-case names to camel case for Go. - convert slices to slice function for closure library. - convert builtin functions to proper function call. - disallow non-builtin functions. - disallow 3-index slicing. - disallow vararg parameter passing. - register imports for Go.
func (*ExprRewriter) RewriteExpression ¶ added in v0.3.0
func (er *ExprRewriter) RewriteExpression(expr string) (string, error)
type OnEvalExpr ¶
type OnEvalExpr func(expr string)