Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Option ¶
`Option` passes the `OptionStatement` in the AST rooted at `node` that has the specified identifier to `fn`. The function can have side effects on the option statement and/or return a non-nil `Expression` that is set as value for the option. If the value returned by the edit function is `nil` (or an error is returned) no new value is set for the option statement (but any, maybe partial, side effect is applied). `Option` returns whether it could find and edit the option (possibly with errors) or not.
Types ¶
type OptionFn ¶
type OptionFn func(opt *ast.OptionStatement) (ast.Expression, error)
`OptionFn` is a function that, provided with an `OptionStatement`, returns an `Expression` or an error. It is used by `Option` functions to edit AST's options statements.
func OptionObjectFn ¶
func OptionObjectFn(keyMap map[string]ast.Expression) OptionFn
Creates an `OptionFn` for updating the values of an `OptionStatement` that has an `ObjectExpression` as value. Returns error if the child of the option statement is not an object expression, or if some key in the provided map is not a property of the object.
func OptionValueFn ¶
func OptionValueFn(expr ast.Expression) OptionFn
Creates an `OptionFn` for setting the value of an `OptionStatement`.