aladino

package
v4.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: LGPL-3.0 Imports: 32 Imported by: 0

README

Aladino language

Documentation

Index

Constants

View Source
const (
	BOOL_CONST          string = "BoolConst"
	INT_CONST           string = "IntConst"
	STRING_CONST        string = "StringConst"
	TIME_CONST          string = "TimeConst"
	VARIABLE_CONST      string = "Variable"
	UNARY_OP_CONST      string = "UnaryOp"
	BINARY_OP_CONST     string = "BinaryOp"
	FUNCTION_CALL_CONST string = "FunctionCall"
	LAMBDA_CONST        string = "Lambda"
	TYPED_EXPR          string = "TypedExpr"
	ARRAY_CONST         string = "Array"
	NOT_OP              string = "!"
	EQ_OP               string = "=="
	NEQ_OP              string = "!="
	AND_OP              string = "&&"
	OR_OP               string = "||"
	LESS_THAN_OP        string = "<"
	LESS_EQ_THAN_OP     string = "<="
	GREATER_THAN_OP     string = ">"
	GREATER_EQ_THAN_OP  string = ">="
)
View Source
const AladinoEofCode = 1
View Source
const AladinoErrCode = 2
View Source
const AladinoFlag = -1000
View Source
const AladinoInitialStackSize = 16
View Source
const AladinoLast = 106
View Source
const AladinoPrivate = 57344
View Source
const DefaultMockEntityNodeID = "test"
View Source
const DefaultMockEventAction = "opened"
View Source
const DefaultMockEventName = "pull_request"
View Source
const DefaultMockPrID = 1234
View Source
const DefaultMockPrNum = 6
View Source
const DefaultMockPrOwner = "foobar"
View Source
const DefaultMockPrRepoName = "default-mock-repo"
View Source
const EOF = 0
View Source
const FALSE = 57362
View Source
const IDENTIFIER = 57348
View Source
const NUMBER = 57360
View Source
const RELATIVETIMESTAMP = 57347
View Source
const ReviewpadMetricReportCommentAnnotation = "<!--@annotation-reviewpad-metric-report-->"
View Source
const ReviewpadReportCommentAnnotation = "<!--@annotation-reviewpad-report-->"
View Source
const STRINGLITERAL = 57349
View Source
const TIMESTAMP = 57346
View Source
const TK_AND = 57364
View Source
const TK_BOOL_ARRAY_TYPE = 57358
View Source
const TK_BOOL_TYPE = 57355
View Source
const TK_CMPOP = 57350
View Source
const TK_EQ = 57365
View Source
const TK_FUNCTION_TYPE = 57359
View Source
const TK_INT_ARRAY_TYPE = 57357
View Source
const TK_INT_TYPE = 57354
View Source
const TK_LAMBDA = 57351
View Source
const TK_NEQ = 57366
View Source
const TK_NOT = 57367
View Source
const TK_OR = 57363
View Source
const TK_STRING_ARRAY_TYPE = 57356
View Source
const TK_STRING_TYPE = 57353
View Source
const TK_TYPE = 57352
View Source
const TRUE = 57361

Variables

View Source
var (
	AladinoDebug        = 0
	AladinoErrorVerbose = false
)
View Source
var AladinoAct = [...]int{}/* 106 elements not displayed */
View Source
var AladinoChk = [...]int{
	-1000, -6, -1, 25, 26, 4, 5, 18, 7, 28,
	30, 19, 20, 22, 21, 23, 24, 8, -1, -1,
	-3, -2, -1, 6, -1, -1, -1, -1, -1, 27,
	32, 9, 29, 31, 26, -4, 11, 12, 13, 28,
	17, -1, -2, -2, 31, 29, 26, 27, 27, -3,
	-1, -4, -5, -4, 27, 31, -4, -5,
}
View Source
var AladinoDef = [...]int{
	0, -2, 1, 0, 28, 9, 10, 11, 12, 31,
	0, 15, 16, 0, 0, 0, 0, 0, 2, 0,
	0, 0, 30, 14, 3, 4, 5, 6, 7, 8,
	0, 0, 13, 31, 31, 27, 19, 20, 21, 0,
	0, 0, 29, 0, 28, 0, 0, 18, 17, 26,
	0, 22, 0, 25, 0, 0, 23, 24,
}
View Source
var AladinoErrorMessages = [...]struct {
	state int
	token int
	msg   string
}{}
View Source
var AladinoExca = [...]int{
	-1, 1,
	1, -1,
	-2, 0,
}
View Source
var AladinoPact = [...]int{
	7, -1000, 75, 7, 7, -1000, -1000, -1000, -1000, 7,
	22, -1000, -1000, 7, 7, 7, 7, 7, -1000, 21,
	15, -16, 46, -3, 28, 81, -1000, -1000, -1000, -1000,
	67, 7, -1000, 7, 7, -22, -1000, -1000, -1000, -19,
	-4, 64, -1000, -6, 7, 67, 67, -1000, -1000, -1000,
	42, -1000, -12, -23, 67, 67, -1000, -1000,
}
View Source
var AladinoPgo = [...]int{
	0, 2, 5, 4, 0, 1, 30,
}
View Source
var AladinoR1 = [...]int{
	0, 6, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 4,
	4, 4, 4, 4, 5, 5, 3, 3, 3, 2,
	2, 2,
}
View Source
var AladinoR2 = [...]int{
	0, 1, 2, 3, 3, 3, 3, 3, 3, 1,
	1, 1, 1, 3, 2, 1, 1, 5, 5, 1,
	1, 1, 3, 5, 3, 1, 5, 3, 0, 3,
	1, 0,
}
View Source
var AladinoStatenames = [...]string{}
View Source
var AladinoTok1 = [...]int{
	1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 30, 3, 3, 3,
	26, 27, 3, 3, 31, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 32, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 28, 3, 29,
}
View Source
var AladinoTok2 = [...]int{
	2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
	12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
	22, 23, 24, 25,
}
View Source
var AladinoTok3 = [...]int{
	0,
}
View Source
var AladinoToknames = [...]string{
	"$end",
	"error",
	"$unk",
	"TIMESTAMP",
	"RELATIVETIMESTAMP",
	"IDENTIFIER",
	"STRINGLITERAL",
	"TK_CMPOP",
	"TK_LAMBDA",
	"TK_TYPE",
	"TK_STRING_TYPE",
	"TK_INT_TYPE",
	"TK_BOOL_TYPE",
	"TK_STRING_ARRAY_TYPE",
	"TK_INT_ARRAY_TYPE",
	"TK_BOOL_ARRAY_TYPE",
	"TK_FUNCTION_TYPE",
	"NUMBER",
	"TRUE",
	"FALSE",
	"TK_OR",
	"TK_AND",
	"TK_EQ",
	"TK_NEQ",
	"TK_NOT",
	"'('",
	"')'",
	"'['",
	"']'",
	"'$'",
	"','",
	"':'",
}
View Source
var DefaultMockCollector, _ = collector.NewCollector("", "distinctId", "pull_request", "runnerName", nil)
View Source
var DefaultMockContext = context.Background()
View Source
var DefaultMockEventDetails = &entities.EventDetails{
	EventName:   DefaultMockEventName,
	EventAction: DefaultMockEventAction,
}
View Source
var DefaultMockLogger = logrus.NewEntry(logrus.New()).WithField("prefix", "[aladino]")
View Source
var DefaultMockPrDate = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
View Source
var DefaultMockTargetEntity = &entities.TargetEntity{
	Owner:  DefaultMockPrOwner,
	Repo:   DefaultMockPrRepoName,
	Number: DefaultMockPrNum,
	Kind:   entities.PullRequest,
}

Functions

func AddReportComment

func AddReportComment(env Env, report string) error

func AladinoErrorMessage

func AladinoErrorMessage(state, lookAhead int) string

func AladinoParse

func AladinoParse(Aladinolex AladinoLexer) int

func AladinoStatname

func AladinoStatname(s int) string

func AladinoTokname

func AladinoTokname(c int) string

func Aladinolex1

func Aladinolex1(lex AladinoLexer, lval *AladinoSymType) (char, token int)

func BuildDryRunExecutionReport

func BuildDryRunExecutionReport(program *engine.Program) string

func BuildInternalLabelID

func BuildInternalLabelID(id string) string

func BuildInternalRuleName

func BuildInternalRuleName(name string) string

func BuildInternalTemporaryVariableName added in v4.12.0

func BuildInternalTemporaryVariableName(name string) string

func BuildVerboseReport

func BuildVerboseReport(report *Report) string

func DeleteReportComment

func DeleteReportComment(env Env, commentId int64) error

func EqualList

func EqualList(left []Expr, right []Expr) bool

func Eval

func Eval(env Env, expr Expr) (lang.Value, error)

func EvalCondition

func EvalCondition(env Env, expr Expr) (bool, error)

EvalCondition evaluates a boolean expression Pre-condition: the type of expr is BoolType

func EvalExpr

func EvalExpr(env Env, kind, expr string) (bool, error)

func FindReportCommentByAnnotation

func FindReportCommentByAnnotation(env Env, annotation string) (*github.IssueComment, error)

func GetDefaultCodeHostClient added in v4.4.0

func GetDefaultCodeHostClient(t *testing.T, pullRequest *pbc.PullRequest, pullRequestErr error) *codehost.CodeHostClient

func GetDefaultMockIssueDetails

func GetDefaultMockIssueDetails() *github.Issue

func GetDefaultMockPullRequestDetailsWith

func GetDefaultMockPullRequestDetailsWith(pullRequest *pbc.PullRequest) *pbc.PullRequest

func GetDefaultPullRequestDetails added in v4.4.0

func GetDefaultPullRequestDetails() *pbc.PullRequest

func GetDefaultPullRequestFileList added in v4.4.0

func GetDefaultPullRequestFileList() []*github.CommitFile

func MockDefaultGithubAppClient

func MockDefaultGithubAppClient(ghApiClientOptions []mock.MockBackendOption) *gh.GithubAppClient

func MockDefaultGithubClient

func MockDefaultGithubClient(ghApiClientOptions []mock.MockBackendOption, ghGraphQLHandler func(http.ResponseWriter, *http.Request)) *gh.GithubClient

func MockDefaultGithubClientWithFiles added in v4.20.0

func MockDefaultGithubClientWithFiles(ghApiClientOptions []mock.MockBackendOption, ghGraphQLHandler func(http.ResponseWriter, *http.Request), files []*github.CommitFile) *gh.GithubClient

func NewInterpreter

func NewInterpreter(
	ctx context.Context,
	logger *logrus.Entry,
	dryRun bool,
	githubClient *gh.GithubClient,
	codeHostClient *codehost.CodeHostClient,
	collector collector.Collector,
	targetEntity *entities.TargetEntity,
	eventPayload interface{},
	builtIns *BuiltIns,
	checkRunID *int64,
) (engine.Interpreter, error)

func TypeInference

func TypeInference(e Env, expr Expr) (lang.Type, error)

func UpdateReportComment

func UpdateReportComment(env Env, commentId int64, report string) error

Types

type AladinoLex

type AladinoLex struct {
	// contains filtered or unexported fields
}

func (*AladinoLex) Error

func (l *AladinoLex) Error(s string)

func (*AladinoLex) Lex

func (l *AladinoLex) Lex(lval *AladinoSymType) int

type AladinoLexer

type AladinoLexer interface {
	Lex(lval *AladinoSymType) int
	Error(s string)
}

type AladinoParser

type AladinoParser interface {
	Parse(AladinoLexer) int
	Lookahead() int
}

func AladinoNewParser

func AladinoNewParser() AladinoParser

type AladinoParserImpl

type AladinoParserImpl struct {
	// contains filtered or unexported fields
}

func (*AladinoParserImpl) Lookahead

func (p *AladinoParserImpl) Lookahead() int

func (*AladinoParserImpl) Parse

func (Aladinorcvr *AladinoParserImpl) Parse(Aladinolex AladinoLexer) int

type AladinoSymType

type AladinoSymType struct {
	// contains filtered or unexported fields
}

type AndOp

type AndOp struct{}

func (*AndOp) Eval

func (op *AndOp) Eval(lhs, rhs lang.Value) lang.Value

type Array

type Array struct {
	// contains filtered or unexported fields
}

func BuildArray

func BuildArray(elems []Expr) *Array

func (*Array) Eval

func (a *Array) Eval(e Env) (lang.Value, error)

func (*Array) Kind

func (a *Array) Kind() string

type BaseEnv

type BaseEnv struct {
	BuiltIns                 *BuiltIns
	BuiltInsReportedMessages map[Severity][]string
	GithubClient             *gh.GithubClient
	CodeHostClient           *codehost.CodeHostClient
	Collector                collector.Collector
	Ctx                      context.Context
	DryRun                   bool
	EventPayload             interface{}
	RegisterMap              RegisterMap
	Report                   *Report
	Target                   codehost.Target
	Logger                   *logrus.Entry
	ExecWaitGroup            *sync.WaitGroup
	ExecMutex                *sync.Mutex
	ExecFatalErrorOccurred   error
	CheckRunID               *int64
	CheckRunConclusion       string
}

func (*BaseEnv) GetBuiltIns

func (e *BaseEnv) GetBuiltIns() *BuiltIns

func (*BaseEnv) GetBuiltInsReportedMessages

func (e *BaseEnv) GetBuiltInsReportedMessages() map[Severity][]string

func (*BaseEnv) GetCheckRunConclusion added in v4.10.0

func (e *BaseEnv) GetCheckRunConclusion() string

func (*BaseEnv) GetCheckRunID added in v4.10.0

func (e *BaseEnv) GetCheckRunID() *int64

func (*BaseEnv) GetCodeHostClient added in v4.4.0

func (e *BaseEnv) GetCodeHostClient() *codehost.CodeHostClient

func (*BaseEnv) GetCollector

func (e *BaseEnv) GetCollector() collector.Collector

func (*BaseEnv) GetCtx

func (e *BaseEnv) GetCtx() context.Context

func (*BaseEnv) GetDryRun

func (e *BaseEnv) GetDryRun() bool

func (*BaseEnv) GetEventPayload

func (e *BaseEnv) GetEventPayload() interface{}

func (*BaseEnv) GetExecFatalErrorOccurred added in v4.9.0

func (e *BaseEnv) GetExecFatalErrorOccurred() error

func (*BaseEnv) GetExecWaitGroup added in v4.9.0

func (e *BaseEnv) GetExecWaitGroup() *sync.WaitGroup

func (*BaseEnv) GetGithubClient

func (e *BaseEnv) GetGithubClient() *gh.GithubClient

func (*BaseEnv) GetLogger

func (e *BaseEnv) GetLogger() *logrus.Entry

func (*BaseEnv) GetRegisterMap

func (e *BaseEnv) GetRegisterMap() RegisterMap

func (*BaseEnv) GetReport

func (e *BaseEnv) GetReport() *Report

func (*BaseEnv) GetTarget

func (e *BaseEnv) GetTarget() codehost.Target

func (*BaseEnv) SetCheckRunConclusion added in v4.10.0

func (e *BaseEnv) SetCheckRunConclusion(conclusion string)

func (*BaseEnv) SetExecFatalErrorOccurred added in v4.9.0

func (e *BaseEnv) SetExecFatalErrorOccurred(err error)

type BinaryOp

type BinaryOp struct {
	// contains filtered or unexported fields
}

func BuildAndOp

func BuildAndOp(lhs Expr, rhs Expr) *BinaryOp

func BuildBinaryOp

func BuildBinaryOp(lhs Expr, op BinaryOperator, rhs Expr) *BinaryOp

func BuildEqOp

func BuildEqOp(lhs Expr, rhs Expr) *BinaryOp

func BuildGreaterEqThanOp

func BuildGreaterEqThanOp(lhs Expr, rhs Expr) *BinaryOp

func BuildGreaterThanOp

func BuildGreaterThanOp(lhs Expr, rhs Expr) *BinaryOp

func BuildLessEqThanOp

func BuildLessEqThanOp(lhs Expr, rhs Expr) *BinaryOp

func BuildLessThanOp

func BuildLessThanOp(lhs Expr, rhs Expr) *BinaryOp

func BuildNeqOp

func BuildNeqOp(lhs Expr, rhs Expr) *BinaryOp

func BuildOrOp

func BuildOrOp(lhs Expr, rhs Expr) *BinaryOp

func (*BinaryOp) Eval

func (b *BinaryOp) Eval(e Env) (lang.Value, error)

func (*BinaryOp) Kind

func (b *BinaryOp) Kind() string

type BinaryOperator

type BinaryOperator interface {
	Eval(lhs, rhs lang.Value) lang.Value
	// contains filtered or unexported methods
}

type BoolConst

type BoolConst struct {
	// contains filtered or unexported fields
}

func BuildBoolConst

func BuildBoolConst(bVal bool) *BoolConst

func (*BoolConst) Eval

func (b *BoolConst) Eval(e Env) (lang.Value, error)

func (*BoolConst) Kind

func (b *BoolConst) Kind() string

type BuiltInAction

type BuiltInAction struct {
	Type              lang.Type
	Code              func(e Env, args []lang.Value) error
	Disabled          bool
	SupportedKinds    []entities.TargetEntityKind
	RunAsynchronously bool
}

type BuiltInFunction

type BuiltInFunction struct {
	Type           lang.Type
	Code           func(e Env, args []lang.Value) (lang.Value, error)
	SupportedKinds []entities.TargetEntityKind
}

type BuiltIns

type BuiltIns struct {
	Functions map[string]*BuiltInFunction
	Actions   map[string]*BuiltInAction
	Services  map[string]interface{}
}

func MergeAladinoBuiltIns

func MergeAladinoBuiltIns(builtInsList ...*BuiltIns) *BuiltIns

func MockBuiltIns

func MockBuiltIns() *BuiltIns

type Env

type Env interface {
	GetBuiltIns() *BuiltIns
	GetBuiltInsReportedMessages() map[Severity][]string
	GetGithubClient() *gh.GithubClient
	GetCodeHostClient() *codehost.CodeHostClient
	GetCollector() collector.Collector
	GetCtx() context.Context
	GetDryRun() bool
	GetEventPayload() interface{}
	GetRegisterMap() RegisterMap
	GetReport() *Report
	GetTarget() codehost.Target
	GetLogger() *logrus.Entry
	GetExecWaitGroup() *sync.WaitGroup
	GetExecFatalErrorOccurred() error
	SetExecFatalErrorOccurred(error)
	GetCheckRunID() *int64
	SetCheckRunConclusion(string)
	GetCheckRunConclusion() string
}

func MockDefaultEnv

func MockDefaultEnv(
	t *testing.T,
	ghApiClientOptions []mock.MockBackendOption,
	ghGraphQLHandler func(http.ResponseWriter, *http.Request),
	builtIns *BuiltIns,
	eventPayload interface{},
) Env

MockDefaultEnv mocks an Aladino Env with default values.

func MockDefaultEnvWithPullRequestAndFiles added in v4.4.0

func MockDefaultEnvWithPullRequestAndFiles(
	t *testing.T,
	ghApiClientOptions []mock.MockBackendOption,
	ghGraphQLHandler func(http.ResponseWriter, *http.Request),
	pullRequest *pbc.PullRequest,
	files []*github.CommitFile,
	builtIns *BuiltIns,
	eventPayload interface{},
) Env

func MockDefaultEnvWithTargetEntity

func MockDefaultEnvWithTargetEntity(
	t *testing.T,
	ghApiClientOptions []mock.MockBackendOption,
	ghGraphQLHandler func(http.ResponseWriter, *http.Request),
	builtIns *BuiltIns,
	eventPayload interface{},
	targetEntity *entities.TargetEntity,
) Env

MockDefaultEnvWithTargetEntity mocks an Aladino Env with default values and a custom TargetEntity.

func NewEvalEnv

func NewEvalEnv(
	ctx context.Context,
	logger *logrus.Entry,
	dryRun bool,
	githubClient *gh.GithubClient,
	codeHostClient *codehost.CodeHostClient,
	collector collector.Collector,
	targetEntity *entities.TargetEntity,
	eventPayload interface{},
	builtIns *BuiltIns,
	checkRunID *int64,
) (Env, error)

type EqOp

type EqOp struct{}

func (*EqOp) Eval

func (op *EqOp) Eval(lhs, rhs lang.Value) lang.Value

type ExecExpr

type ExecExpr interface {
	// contains filtered or unexported methods
}

func TypeCheckExec

func TypeCheckExec(env Env, expr Expr) (ExecExpr, error)

type Expr

type Expr interface {
	Kind() string

	Eval(Env) (lang.Value, error)
	// contains filtered or unexported methods
}

func BuildCmpOp

func BuildCmpOp(lhs Expr, op string, rhs Expr) Expr

func BuildFilter

func BuildFilter(param string, condition Expr) (Expr, error)

func Parse

func Parse(input string) (Expr, error)

type FunctionCall

type FunctionCall struct {
	// contains filtered or unexported fields
}

func BuildFunctionCall

func BuildFunctionCall(name *Variable, arguments []Expr) *FunctionCall

func (*FunctionCall) Eval

func (fc *FunctionCall) Eval(e Env) (lang.Value, error)

func (*FunctionCall) Kind

func (fc *FunctionCall) Kind() string

type GreaterEqThanOp

type GreaterEqThanOp struct{}

func (*GreaterEqThanOp) Eval

func (op *GreaterEqThanOp) Eval(lhs, rhs lang.Value) lang.Value

type GreaterThanOp

type GreaterThanOp struct{}

func (*GreaterThanOp) Eval

func (op *GreaterThanOp) Eval(lhs, rhs lang.Value) lang.Value

type IntConst

type IntConst struct {
	// contains filtered or unexported fields
}

func BuildIntConst

func BuildIntConst(val int) *IntConst

func BuildRelativeTimeConst

func BuildRelativeTimeConst(val string) *IntConst

func BuildTimeConst

func BuildTimeConst(val string) *IntConst

func (*IntConst) Eval

func (i *IntConst) Eval(e Env) (lang.Value, error)

func (*IntConst) Kind

func (i *IntConst) Kind() string

type Interpreter

type Interpreter struct {
	Env Env
}

func (*Interpreter) EvalExpr

func (i *Interpreter) EvalExpr(kind, expr string) (bool, error)

func (*Interpreter) ExecProgram

func (i *Interpreter) ExecProgram(program *engine.Program) (engine.ExitStatus, error)

func (*Interpreter) ExecStatement

func (i *Interpreter) ExecStatement(statement *engine.Statement) error

func (*Interpreter) GetCheckRunConclusion added in v4.10.0

func (i *Interpreter) GetCheckRunConclusion() string

func (*Interpreter) ProcessDictionary added in v4.14.0

func (i *Interpreter) ProcessDictionary(name string, dictionary map[string]string) error

func (*Interpreter) ProcessGroup

func (i *Interpreter) ProcessGroup(groupName string, kind engine.GroupKind, typeOf engine.GroupType, expr, paramExpr, whereExpr string) error

func (*Interpreter) ProcessIterable added in v4.14.0

func (i *Interpreter) ProcessIterable(expr string) (lang.Value, error)

func (*Interpreter) ProcessLabel

func (i *Interpreter) ProcessLabel(id, name string) error

func (*Interpreter) ProcessRule

func (i *Interpreter) ProcessRule(name, spec string) error

func (*Interpreter) Report

func (i *Interpreter) Report(mode string, safeMode bool) error

func (*Interpreter) ReportMetrics

func (i *Interpreter) ReportMetrics() error

func (*Interpreter) StoreTemporaryVariable added in v4.12.0

func (i *Interpreter) StoreTemporaryVariable(name string, value lang.Value)

type Lambda

type Lambda struct {
	// contains filtered or unexported fields
}

func BuildLambda

func BuildLambda(parameters []Expr, body Expr) *Lambda

func (*Lambda) Eval

func (lambda *Lambda) Eval(e Env) (lang.Value, error)

func (*Lambda) Kind

func (l *Lambda) Kind() string

type LessEqThanOp

type LessEqThanOp struct{}

func (*LessEqThanOp) Eval

func (op *LessEqThanOp) Eval(lhs, rhs lang.Value) lang.Value

type LessThanOp

type LessThanOp struct{}

func (*LessThanOp) Eval

func (op *LessThanOp) Eval(lhs, rhs lang.Value) lang.Value

type NeqOp

type NeqOp struct{}

func (*NeqOp) Eval

func (op *NeqOp) Eval(lhs, rhs lang.Value) lang.Value

type NotOp

type NotOp struct{}

func (*NotOp) Eval

func (op *NotOp) Eval(exprVal lang.Value) lang.Value

type OrOp

type OrOp struct{}

func (*OrOp) Eval

func (op *OrOp) Eval(lhs, rhs lang.Value) lang.Value

type RegisterMap

type RegisterMap map[string]lang.Value

type Report

type Report struct {
	Actions []string
}

type Severity

type Severity int
const (
	SEVERITY_FAIL    Severity = 0
	SEVERITY_FATAL   Severity = 1
	SEVERITY_ERROR   Severity = 2
	SEVERITY_WARNING Severity = 3
	SEVERITY_INFO    Severity = 4
)

type StringConst

type StringConst struct {
	// contains filtered or unexported fields
}

func BuildStringConst

func BuildStringConst(val string) *StringConst

func (*StringConst) Eval

func (c *StringConst) Eval(e Env) (lang.Value, error)

func (*StringConst) Kind

func (c *StringConst) Kind() string

type TypeEnv

type TypeEnv map[string]lang.Type

func MockTypeEnv

func MockTypeEnv() TypeEnv

func NewTypeEnv

func NewTypeEnv(e Env) TypeEnv

type TypedExpr

type TypedExpr struct {
	// contains filtered or unexported fields
}

func BuildTypedExpr

func BuildTypedExpr(expr Expr, typeOf lang.Type) *TypedExpr

func (*TypedExpr) Eval

func (te *TypedExpr) Eval(e Env) (lang.Value, error)

func (*TypedExpr) Kind

func (te *TypedExpr) Kind() string

type UnaryOp

type UnaryOp struct {
	// contains filtered or unexported fields
}

func BuildNotOp

func BuildNotOp(expr Expr) *UnaryOp

func BuildUnaryOp

func BuildUnaryOp(op UnaryOperator, expr Expr) *UnaryOp

func (*UnaryOp) Eval

func (u *UnaryOp) Eval(e Env) (lang.Value, error)

func (*UnaryOp) Kind

func (b *UnaryOp) Kind() string

type UnaryOperator

type UnaryOperator interface {
	Eval(exprValue lang.Value) lang.Value
	// contains filtered or unexported methods
}

type UnsupportedKindError added in v4.15.0

type UnsupportedKindError struct {
	Kind           entities.TargetEntityKind
	SupportedKinds []entities.TargetEntityKind
	BuiltIn        string
}

func (*UnsupportedKindError) Error added in v4.15.0

func (e *UnsupportedKindError) Error() string

func (*UnsupportedKindError) SupportedOn added in v4.15.0

func (e *UnsupportedKindError) SupportedOn() string

type Variable

type Variable struct {
	// contains filtered or unexported fields
}

func BuildVariable

func BuildVariable(ident string) *Variable

func (*Variable) Eval

func (v *Variable) Eval(e Env) (lang.Value, error)

func (*Variable) Kind

func (v *Variable) Kind() string

Jump to

Keyboard shortcuts

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