Documentation
¶
Index ¶
- Variables
- func ToBool(v Value) bool
- func ToNumber(v Value) float64
- func ToString(v Value) string
- func ValueToString(value interface{}) string
- type Argument
- type BinaryOpExpr
- type BinaryOpType
- type BoolValue
- type CallExpr
- type ConditionalExpr
- type DotExpr
- type EvalContext
- type Expression
- type ExpressionDef
- type ExpressionEvaluator
- type Function
- type FunctionDefinition
- type FunctionRegistry
- func (fr *FunctionRegistry) Call(name string, args []interface{}, execCtx *execcontext.ExecutionContext) (interface{}, error)
- func (fr *FunctionRegistry) GetCompactPromptDescription() string
- func (fr *FunctionRegistry) GetFunctionDefinition(name string) (*FunctionDefinition, bool)
- func (fr *FunctionRegistry) ListFunctions() []*FunctionDefinition
- type IndexExpr
- type ListValue
- type LiteralExpr
- type MapValue
- type NilValue
- type NumberValue
- type Parser
- type StringValue
- type TemplateEngine
- type Token
- type TokenType
- type UnaryOpExpr
- type UnaryOpType
- type Value
- type ValueType
- type VariableExpr
- type VariableResolver
- type VariableScope
Constants ¶
This section is empty.
Variables ¶
var ( ExpressionDefs []ExpressionDef FunctionDefs []*FunctionDefinition )
var VariablePattern = regexp.MustCompile(`(\$)?\$\{\{\s*(.*?)\s*\}\}`)
VariablePattern is a regular expression that matches variable references in a template.
Functions ¶
func ValueToString ¶
func ValueToString(value interface{}) string
ValueToString converts a value to its string representation
Types ¶
type BinaryOpExpr ¶
type BinaryOpExpr struct {
Left Expression
Op BinaryOpType
Right Expression
}
BinaryOpExpr represents a binary operation
func (*BinaryOpExpr) Definition ¶
func (e *BinaryOpExpr) Definition() ExpressionDef
func (*BinaryOpExpr) Eval ¶
func (e *BinaryOpExpr) Eval(ctx *EvalContext) (Value, error)
type BinaryOpType ¶
type BinaryOpType string
const ( BinaryOpTypeAdd BinaryOpType = "+" BinaryOpTypeSub BinaryOpType = "-" BinaryOpTypeMul BinaryOpType = "*" BinaryOpTypeDiv BinaryOpType = "/" BinaryOpTypeMod BinaryOpType = "%" BinaryOpTypeEq BinaryOpType = "==" BinaryOpTypeNeq BinaryOpType = "!=" BinaryOpTypeLt BinaryOpType = "<" BinaryOpTypeGt BinaryOpType = ">" BinaryOpTypeLte BinaryOpType = "<=" BinaryOpTypeGte BinaryOpType = ">=" BinaryOpTypeAnd BinaryOpType = "&&" BinaryOpTypeOr BinaryOpType = "||" )
type CallExpr ¶
type CallExpr struct {
Name string
Args []Expression
}
CallExpr represents a function call
func (*CallExpr) Definition ¶
func (e *CallExpr) Definition() ExpressionDef
type ConditionalExpr ¶
type ConditionalExpr struct {
Condition Expression
TrueExpr Expression
FalseExpr Expression
}
ConditionalExpr represents a ternary conditional expression
func (*ConditionalExpr) Definition ¶
func (e *ConditionalExpr) Definition() ExpressionDef
func (*ConditionalExpr) Eval ¶
func (e *ConditionalExpr) Eval(ctx *EvalContext) (Value, error)
type DotExpr ¶
type DotExpr struct {
Object Expression
Field string
}
DotExpr represents object property access
func (*DotExpr) Definition ¶
func (e *DotExpr) Definition() ExpressionDef
type EvalContext ¶
type EvalContext struct {
Variables *VariableScope
Functions *FunctionRegistry
ExecCtx *execcontext.ExecutionContext
}
EvalContext contains the context for expression evaluation
type Expression ¶
type Expression interface {
Eval(*EvalContext) (Value, error)
Definition() ExpressionDef
}
func Parse ¶
func Parse(input string) (Expression, error)
type ExpressionDef ¶
type ExpressionEvaluator ¶
type ExpressionEvaluator struct {
// contains filtered or unexported fields
}
ExpressionEvaluator handles expression evaluation
func NewExpressionEvaluator ¶
func NewExpressionEvaluator() *ExpressionEvaluator
NewExpressionEvaluator creates a new expression evaluator
func (*ExpressionEvaluator) Evaluate ¶
func (ee *ExpressionEvaluator) Evaluate(expression string, execCtx *execcontext.ExecutionContext) (interface{}, error)
Evaluate evaluates an expression
type Function ¶
type Function func(args []interface{}, execCtx *execcontext.ExecutionContext) (interface{}, error)
Function represents a built-in function
type FunctionDefinition ¶
type FunctionRegistry ¶
type FunctionRegistry struct {
// contains filtered or unexported fields
}
FunctionRegistry manages built-in functions for expressions
func NewFunctionRegistry ¶
func NewFunctionRegistry() *FunctionRegistry
NewFunctionRegistry creates a new function registry with all GitHub Actions functions
func (*FunctionRegistry) Call ¶
func (fr *FunctionRegistry) Call(name string, args []interface{}, execCtx *execcontext.ExecutionContext) (interface{}, error)
Call invokes a function with the given arguments
func (*FunctionRegistry) GetCompactPromptDescription ¶
func (fr *FunctionRegistry) GetCompactPromptDescription() string
GetCompactPromptDescription returns a condensed version suitable for shorter prompts
func (*FunctionRegistry) GetFunctionDefinition ¶
func (fr *FunctionRegistry) GetFunctionDefinition(name string) (*FunctionDefinition, bool)
GetFunctionDefinition returns the function definition for a given name
func (*FunctionRegistry) ListFunctions ¶
func (fr *FunctionRegistry) ListFunctions() []*FunctionDefinition
ListFunctions returns all available function definitions sorted by name
type IndexExpr ¶
type IndexExpr struct {
Object Expression
Index Expression
}
IndexExpr represents array/map indexing
func (*IndexExpr) Definition ¶
func (e *IndexExpr) Definition() ExpressionDef
type LiteralExpr ¶
type LiteralExpr struct {
Value Value
}
LiteralExpr represents a literal value
func (*LiteralExpr) Definition ¶
func (e *LiteralExpr) Definition() ExpressionDef
func (*LiteralExpr) Description ¶
func (e *LiteralExpr) Description() string
func (*LiteralExpr) Eval ¶
func (e *LiteralExpr) Eval(ctx *EvalContext) (Value, error)
type NumberValue ¶
type NumberValue struct {
Val float64
}
func (NumberValue) Equals ¶
func (v NumberValue) Equals(other Value) bool
func (NumberValue) GoValue ¶
func (v NumberValue) GoValue() interface{}
func (NumberValue) String ¶
func (v NumberValue) String() string
func (NumberValue) Type ¶
func (v NumberValue) Type() ValueType
type StringValue ¶
type StringValue struct {
Val string
}
func (StringValue) Equals ¶
func (v StringValue) Equals(other Value) bool
func (StringValue) GoValue ¶
func (v StringValue) GoValue() interface{}
func (StringValue) String ¶
func (v StringValue) String() string
func (StringValue) Type ¶
func (v StringValue) Type() ValueType
type TemplateEngine ¶
type TemplateEngine struct {
// contains filtered or unexported fields
}
TemplateEngine handles variable interpolation and template rendering
func NewTemplateEngine ¶
func NewTemplateEngine() *TemplateEngine
NewTemplateEngine creates a new template engine
func (*TemplateEngine) Render ¶
func (te *TemplateEngine) Render(template string, execCtx *execcontext.ExecutionContext) (interface{}, error)
Render renders a template string with variables from the execution context
type TokenType ¶
type TokenType int
const ( TokenEOF TokenType = iota TokenIdent TokenNumber TokenString TokenEq // == TokenNe // != TokenLt // < TokenGt // > TokenLe // <= TokenGe // >= TokenAnd // && TokenOr // || TokenNot // ! TokenPlus // + TokenMinus // - TokenMul // * TokenDiv // / TokenMod // % TokenQuestion // ? TokenColon // : TokenLParen // ( TokenRParen // ) TokenLBracket // [ TokenRBracket // ] TokenDot // . TokenComma // , )
type UnaryOpExpr ¶
type UnaryOpExpr struct {
Op UnaryOpType
Expr Expression
}
UnaryOpExpr represents a unary operation
func (*UnaryOpExpr) Definition ¶
func (e *UnaryOpExpr) Definition() ExpressionDef
func (*UnaryOpExpr) Eval ¶
func (e *UnaryOpExpr) Eval(ctx *EvalContext) (Value, error)
type UnaryOpType ¶
type UnaryOpType string
const ( UnaryOpTypeNot UnaryOpType = "!" UnaryOpTypeNeg UnaryOpType = "-" )
type VariableExpr ¶
type VariableExpr struct {
Name string
}
VariableExpr represents a variable reference
func (*VariableExpr) Definition ¶
func (e *VariableExpr) Definition() ExpressionDef
func (*VariableExpr) Eval ¶
func (e *VariableExpr) Eval(ctx *EvalContext) (Value, error)
type VariableResolver ¶
type VariableResolver struct{}
VariableResolver handles variable resolution from the execution context
func NewVariableResolver ¶
func NewVariableResolver() *VariableResolver
NewVariableResolver creates a new variable resolver
func (*VariableResolver) ResolveVariable ¶
func (vr *VariableResolver) ResolveVariable(varPath string, execCtx *execcontext.ExecutionContext) (interface{}, error)
ResolveVariable resolves a variable path from the execution context
type VariableScope ¶
type VariableScope struct {
// contains filtered or unexported fields
}
VariableScope manages variable resolution
func NewVariableScope ¶
func NewVariableScope(execCtx *execcontext.ExecutionContext) *VariableScope
NewVariableScope creates a new variable scope