cel/interpreter/context

Types

pub type Callable {
  Callable(
    call: fn(FunctionContext) -> Result(Value, ExecutionError),
  )
}

Constructors

  • Callable(
      call: fn(FunctionContext) -> Result(Value, ExecutionError),
    )
pub type Context {
  Root(
    variables: Dict(String, Value),
    functions: Dict(String, Callable),
  )
  Child(variables: Dict(String, Value), parent: Context)
}

Constructors

  • Root(
      variables: Dict(String, Value),
      functions: Dict(String, Callable),
    )
  • Child(variables: Dict(String, Value), parent: Context)
pub type FunctionContext {
  FunctionContext(
    name: String,
    this: Option(Value),
    ctx: Context,
    args: List(Expression),
  )
}

Constructors

  • FunctionContext(
      name: String,
      this: Option(Value),
      ctx: Context,
      args: List(Expression),
    )

Functions

pub fn empty() -> Context
pub fn insert_function(
  ctx: Context,
  name: String,
  func: fn(FunctionContext) -> Result(Value, ExecutionError),
) -> Context
pub fn insert_variable(
  ctx: Context,
  name: String,
  value: Value,
) -> Context
pub fn new_inner(ctx: Context) -> Context
pub fn resolve_function(
  ctx: Context,
  name: String,
) -> Result(Callable, ContextError)
pub fn resolve_variable(
  ctx: Context,
  name: String,
) -> Result(Value, ContextError)
pub fn try_insert_variable(
  ctx: Context,
  name: String,
  input: Dynamic,
) -> Result(Context, ContextError)
Search Document