conf

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindSuitableOperatorOverload

func FindSuitableOperatorOverload(fns []string, types TypesTable, l, r reflect.Type) (reflect.Type, string, bool)

Types

type Config

type Config struct {
	Env          interface{}
	MapEnv       bool
	Types        TypesTable
	Operators    OperatorsTable
	Expect       reflect.Kind
	Optimize     bool
	Strict       bool
	DefaultType  reflect.Type
	ConstExprFns map[string]reflect.Value
	Visitors     []ast.Visitor
	// contains filtered or unexported fields
}

func New

func New(env interface{}) *Config

func (*Config) Check

func (c *Config) Check() error

Check validates the compiler configuration.

func (*Config) ConstExpr

func (c *Config) ConstExpr(name string)

func (*Config) Error

func (c *Config) Error(err error)

type OperatorsTable

type OperatorsTable map[string][]string

OperatorsTable maps binary operators to corresponding list of functions. Functions should be provided in the environment to allow operator overloading.

type Tag

type Tag struct {
	Type   reflect.Type
	Method bool
}

type TypesTable

type TypesTable map[string]Tag

func CreateTypesTable

func CreateTypesTable(i interface{}) TypesTable

CreateTypesTable creates types table for type checks during parsing. If struct is passed, all fields will be treated as variables, as well as all fields of embedded structs and struct itself.

If map is passed, all items will be treated as variables (key as name, value as type).

func FieldsFromStruct

func FieldsFromStruct(t reflect.Type) TypesTable

Jump to

Keyboard shortcuts

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