lang

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExternFunctionMetadata = []ast.FunctionMetadata{
	{
		Name:          "ip",
		ReturnType:    config.IP_ADDRESS,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "timestamp",
		ReturnType:    config.TIMESTAMP,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "dnsName",
		ReturnType:    config.DNS_NAME,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "email",
		ReturnType:    config.EMAIL_ADDRESS,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "uri",
		ReturnType:    config.URI,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "match",
		ReturnType:    config.BOOL,
		ArgumentTypes: []config.ValueType{config.STRING, config.STRING},
	},
	{
		Name:          "matches",
		Instance:      true,
		TargetType:    config.STRING,
		ReturnType:    config.BOOL,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "startsWith",
		Instance:      true,
		TargetType:    config.STRING,
		ReturnType:    config.BOOL,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "endsWith",
		Instance:      true,
		TargetType:    config.STRING,
		ReturnType:    config.BOOL,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
	{
		Name:          "emptyStringMap",
		ReturnType:    config.STRING_MAP,
		ArgumentTypes: []config.ValueType{},
	},
	{
		Name:          "conditionalString",
		ReturnType:    config.STRING,
		ArgumentTypes: []config.ValueType{config.BOOL, config.STRING, config.STRING},
	},
	{
		Name:          "toLower",
		ReturnType:    config.STRING,
		ArgumentTypes: []config.ValueType{config.STRING},
	},
}

ExternFunctionMetadata is the type-metadata about externs. It gets used during compilations.

View Source
var Externs = map[string]interpreter.Extern{
	"ip":                interpreter.ExternFromFn("ip", ExternIP),
	"ip_equal":          interpreter.ExternFromFn("ip_equal", ExternIPEqual),
	"timestamp":         interpreter.ExternFromFn("timestamp", externTimestamp),
	"timestamp_equal":   interpreter.ExternFromFn("timestamp_equal", externTimestampEqual),
	"timestamp_lt":      interpreter.ExternFromFn("timestamp_lt", externTimestampLt),
	"timestamp_le":      interpreter.ExternFromFn("timestamp_le", externTimestampLe),
	"timestamp_gt":      interpreter.ExternFromFn("timestamp_gt", externTimestampGt),
	"timestamp_ge":      interpreter.ExternFromFn("timestamp_ge", externTimestampGe),
	"dnsName":           interpreter.ExternFromFn("dnsName", ExternDNSName),
	"dnsName_equal":     interpreter.ExternFromFn("dnsName_equal", ExternDNSNameEqual),
	"email":             interpreter.ExternFromFn("email", ExternEmail),
	"email_equal":       interpreter.ExternFromFn("email_equal", ExternEmailEqual),
	"uri":               interpreter.ExternFromFn("uri", ExternURI),
	"uri_equal":         interpreter.ExternFromFn("uri_equal", ExternURIEqual),
	"match":             interpreter.ExternFromFn("match", ExternMatch),
	"matches":           interpreter.ExternFromFn("matches", externMatches),
	"startsWith":        interpreter.ExternFromFn("startsWith", ExternStartsWith),
	"endsWith":          interpreter.ExternFromFn("endsWith", ExternEndsWith),
	"emptyStringMap":    interpreter.ExternFromFn("emptyStringMap", externEmptyStringMap),
	"conditionalString": interpreter.ExternFromFn("conditionalString", externConditionalString),
	"toLower":           interpreter.ExternFromFn("toLower", ExternToLower),
}

Externs contains the list of standard external functions used during evaluation.

Functions

func ExternDNSName

func ExternDNSName(in string) (string, error)

ExternDNSName converts a string to a DNS name

func ExternDNSNameEqual

func ExternDNSNameEqual(n1 string, n2 string) (bool, error)

ExternDNSNameEqual compares two DNS names for equality

func ExternEmail

func ExternEmail(in string) (string, error)

ExternEmail converts a string to an email address

func ExternEmailEqual

func ExternEmailEqual(e1 string, e2 string) (bool, error)

ExternEmailEqual compares two email addresses for equality

func ExternEndsWith

func ExternEndsWith(str string, suffix string) bool

ExternEndsWith checks for suffixes

func ExternIP

func ExternIP(in string) ([]byte, error)

ExternIP creates an IP address

func ExternIPEqual

func ExternIPEqual(a []byte, b []byte) bool

ExternIPEqual compares two IP addresses for equality

func ExternMatch

func ExternMatch(str string, pattern string) bool

ExternMatch provides wildcard matching for strings

func ExternStartsWith

func ExternStartsWith(str string, prefix string) bool

ExternStartsWith checks for prefixes

func ExternToLower

func ExternToLower(str string) string

ExternToLower changes the string case to lower

func ExternURI

func ExternURI(in string) (string, error)

ExternURI converts a string to a URI

func ExternURIEqual

func ExternURIEqual(u1 string, u2 string) (bool, error)

ExternURIEqual compares two URIs for equality

Types

This section is empty.

Directories

Path Synopsis
Package compiler implements a compiler that converts Mixer's expression language into a Mixer IL-based program that can be executed via an interpreter.
Package compiler implements a compiler that converts Mixer's expression language into a Mixer IL-based program that can be executed via an interpreter.

Jump to

Keyboard shortcuts

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