Documentation ¶
Index ¶
- Constants
- Variables
- func AddItemToValueMap(m *sysl.Value, name string, val *sysl.Value)
- func AppendItemToValueList(m *sysl.Value_List, val *sysl.Value)
- func Eval(ee *exprEval, assign Scope, e *sysl.Expr) *sysl.Value
- func EvaluateApp(app *sysl.Application, view *sysl.View, s Scope) *sysl.Value
- func EvaluateView(mod *sysl.Module, appName, viewName string, s Scope) *sysl.Value
- func FindAllString(pattern, word string, n int) []string
- func GetValueSlice(obj *sysl.Value) []*sysl.Value
- func IsCollectionType(obj *sysl.Value) bool
- func MakeValueBool(val bool) *sysl.Value
- func MakeValueI64(val int64) *sysl.Value
- func MakeValueList(values ...*sysl.Value) *sysl.Value
- func MakeValueMap() *sysl.Value
- func MakeValueSet() *sysl.Value
- func MakeValueString(val string) *sysl.Value
- func MatchString(pattern, word string) bool
- func TypeToValue(t *sysl.Type) *sysl.Value
- func UnaryString(arg *sysl.Value) *sysl.Value
- type DebugFunc
- type DefaultBinExprStrategy
- type LHSOverRHSStrategy
- type NegateBinExprStrategy
- type Scope
- type Strategy
Constants ¶
const ( ValueNoArg valueType = -1 ValueBool valueType = iota ValueInt ValueFloat ValueString ValueStringDecimal ValueList ValueMap ValueSet ValueNull )
const definitions for various sysl.Value types
Variables ¶
var EnableDebugger = false
var ( // GoFuncMap is Map of Function Names to goFunc{} GoFuncMap = map[string]goFunc{ "Contains": {reflect.ValueOf(strings.Contains), []*sysl.Type{stringType, stringType}, boolType}, "Count": {reflect.ValueOf(strings.Count), []*sysl.Type{stringType, stringType}, intType}, "Fields": {reflect.ValueOf(strings.Fields), []*sysl.Type{stringType}, listStringType}, "FindAllString": {reflect.ValueOf(FindAllString), []*sysl.Type{stringType, stringType, intType}, listStringType}, "HasPrefix": {reflect.ValueOf(strings.HasPrefix), []*sysl.Type{stringType, stringType}, boolType}, "HasSuffix": {reflect.ValueOf(strings.HasSuffix), []*sysl.Type{stringType, stringType}, boolType}, "Join": {reflect.ValueOf(strings.Join), []*sysl.Type{listStringType, stringType}, stringType}, "LastIndex": {reflect.ValueOf(strings.LastIndex), []*sysl.Type{stringType, stringType}, intType}, "MatchString": {reflect.ValueOf(MatchString), []*sysl.Type{stringType, stringType}, boolType}, "Replace": {reflect.ValueOf(strings.Replace), []*sysl.Type{stringType, stringType, stringType, intType}, stringType}, "Split": {reflect.ValueOf(strings.Split), []*sysl.Type{stringType, stringType}, listStringType}, "Title": {reflect.ValueOf(titleCaser.String), []*sysl.Type{stringType}, stringType}, "ToLower": {reflect.ValueOf(strings.ToLower), []*sysl.Type{stringType}, stringType}, "ToTitle": {reflect.ValueOf(strings.ToTitle), []*sysl.Type{stringType}, stringType}, "ToUpper": {reflect.ValueOf(strings.ToUpper), []*sysl.Type{stringType}, stringType}, "Trim": {reflect.ValueOf(strings.Trim), []*sysl.Type{stringType, stringType}, stringType}, "TrimLeft": {reflect.ValueOf(strings.TrimLeft), []*sysl.Type{stringType, stringType}, stringType}, "TrimPrefix": {reflect.ValueOf(strings.TrimPrefix), []*sysl.Type{stringType, stringType}, stringType}, "TrimRight": {reflect.ValueOf(strings.TrimRight), []*sysl.Type{stringType, stringType}, stringType}, "TrimSpace": {reflect.ValueOf(strings.TrimSpace), []*sysl.Type{stringType}, stringType}, "TrimSuffix": {reflect.ValueOf(strings.TrimSuffix), []*sysl.Type{stringType, stringType}, stringType}, } )
Functions ¶
func AddItemToValueMap ¶
expects m.Value to be of type Value_Map
func AppendItemToValueList ¶
func AppendItemToValueList(m *sysl.Value_List, val *sysl.Value)
func EvaluateApp ¶
func EvaluateView ¶
EvaluateView evaluate the view using the Scope
func FindAllString ¶
FindAllString exposes regexp.FindAllString to sysl transforms
func GetValueSlice ¶
GetValueSlice returns the slice from either a set or a list
func IsCollectionType ¶
IsCollectionType does obj holds multiple instances of the same thing?
func MakeValueBool ¶
MakeValueBool returns sysl.Value of type Value_B (bool)
func MakeValueI64 ¶
MakeValueI64 returns sysl.Value of type Value_I (int64)
func MakeValueList ¶
MakeValueList returns sysl.Value of type Value_List_ ([]*sysl.Value)
func MakeValueMap ¶
MakeValueMap returns sysl.Value of type Value_Map_ (map[string]*sysl.Value)
func MakeValueSet ¶
MakeValueSet returns sysl.Value of type Value_Set ([]*sysl.Value)
func MakeValueString ¶
MakeValueString returns sysl.Value of type Value_S (string)
func MatchString ¶
MatchString exposes regexp.MatchString to sysl transforms
Types ¶
type DefaultBinExprStrategy ¶
type DefaultBinExprStrategy struct{}
DefaultBinExprStrategy is to evaluate lhs and rhs expr's first and then pass it to fn
type LHSOverRHSStrategy ¶
type LHSOverRHSStrategy struct{}
LHSOverRHSStrategy binds rhs expression over each element of the LHS. Assumes lhs is a collection
type NegateBinExprStrategy ¶
type NegateBinExprStrategy struct{}
NegateBinExprStrategy is to evaluate the negative of the DefaultBinExprStrategy
type Scope ¶
Scope holds the value of the variables during the execution of a transform
func (Scope) AddApp ¶
func (s Scope) AddApp(name string, app *sysl.Application)
AddApp add sysl.App to scope