webql/compiler/context

Copy Markdown

Types

Context

pub type Context {
  Context(
    nodes: dict.Dict(String, reference.Node),
    supernodes: dict.Dict(String, reference.Supernode),
    edges: dict.Dict(reference.Input, reference.Edge),
    inputs: dict.Dict(
      List(String),
      #(reference.Input, reference.Port),
    ),
    outputs: dict.Dict(
      List(String),
      #(reference.Output, reference.Port),
    ),
    parameters: dict.Dict(String, reference.Parameter),
    returns: dict.Dict(String, reference.Return),
    contexts: dict.Dict(reference.Supernode, Context),
  )
}
Context(
  nodes: dict.Dict(String, reference.Node),
  supernodes: dict.Dict(String, reference.Supernode),
  edges: dict.Dict(reference.Input, reference.Edge),
  inputs: dict.Dict(
    List(String),
    #(reference.Input, reference.Port),
  ),
  outputs: dict.Dict(
    List(String),
    #(reference.Output, reference.Port),
  ),
  parameters: dict.Dict(String, reference.Parameter),
  returns: dict.Dict(String, reference.Return),
  contexts: dict.Dict(reference.Supernode, Context),
)

Values

add_context

pub fn add_context(
  context: Context,
  supernode: reference.Supernode,
  nested_context: Context,
) -> Context

Adds a nested context to the current context instance.

add_contexts

pub fn add_contexts(
  context: Context,
  contexts: List(#(reference.Supernode, Context)),
) -> Context

Adds nested contexts to the current context instance.

add_edge

pub fn add_edge(
  context: Context,
  edge: reference.Input,
) -> Context

Adds an edge to the current context instance.

add_edges

pub fn add_edges(
  context: Context,
  edges: List(reference.Input),
) -> Context

Adds edges to the current context instance.

add_input

pub fn add_input(
  context: Context,
  input: List(String),
  port: reference.Port,
) -> Context

Adds a typed input to the current context instance.

add_inputs

pub fn add_inputs(
  context: Context,
  inputs: List(#(List(String), reference.Port)),
) -> Context

Adds typed inputs to the current context instance.

add_node

pub fn add_node(context: Context, node: String) -> Context

Adds a node to the current context instance.

add_nodes

pub fn add_nodes(
  context: Context,
  nodes: List(String),
) -> Context

Adds nodes to the current context instance.

add_output

pub fn add_output(
  context: Context,
  output: List(String),
  port: reference.Port,
) -> Context

Adds a typed output to the current context instance.

add_outputs

pub fn add_outputs(
  context: Context,
  outputs: List(#(List(String), reference.Port)),
) -> Context

Adds typed outputs to the current context instance.

add_parameter

pub fn add_parameter(
  context: Context,
  parameter: String,
) -> Context

Adds a parameter to the current context instance.

add_parameters

pub fn add_parameters(
  context: Context,
  parameters: List(String),
) -> Context

Adds parameters to the current context instance.

add_return

pub fn add_return(context: Context, return: String) -> Context

Adds a return to the current context instance.

add_returns

pub fn add_returns(
  context: Context,
  returns: List(String),
) -> Context

Adds returns to the current context instance.

add_supernode

pub fn add_supernode(
  context: Context,
  supernode: String,
) -> Context

Adds a supernode to the current context instance.

add_supernodes

pub fn add_supernodes(
  context: Context,
  supernodes: List(String),
) -> Context

Adds supernodes to the current context instance.

get_context

pub fn get_context(
  context: Context,
  supernode: reference.Supernode,
) -> Result(Context, Nil)

Looks up a nested context by supernode reference.

get_edge

pub fn get_edge(
  context: Context,
  input: reference.Input,
) -> Result(reference.Edge, Nil)

Looks up an edge reference by input reference.

get_input

pub fn get_input(
  context: Context,
  path: List(String),
) -> Result(#(reference.Input, reference.Port), Nil)

Looks up a typed input by path.

get_node

pub fn get_node(
  context: Context,
  node: String,
) -> Result(reference.Node, Nil)

Looks up a node reference by name.

get_output

pub fn get_output(
  context: Context,
  path: List(String),
) -> Result(#(reference.Output, reference.Port), Nil)

Looks up a typed output by path.

get_parameter

pub fn get_parameter(
  context: Context,
  parameter: String,
) -> Result(reference.Parameter, Nil)

Looks up a parameter reference by name.

get_return

pub fn get_return(
  context: Context,
  return: String,
) -> Result(reference.Return, Nil)

Looks up a return reference by name.

get_supernode

pub fn get_supernode(
  context: Context,
  supernode: String,
) -> Result(reference.Supernode, Nil)

Looks up a supernode reference by name.

new

pub fn new() -> Context

Creates a new context.

next_edge

pub fn next_edge(context: Context) -> reference.Edge

Gets the next stable edge reference.

next_input

pub fn next_input(context: Context) -> reference.Input

Gets the next stable input reference.

next_node

pub fn next_node(context: Context) -> reference.Node

Gets the next stable node reference.

next_output

pub fn next_output(context: Context) -> reference.Output

Gets the next stable output reference.

next_parameter

pub fn next_parameter(context: Context) -> reference.Parameter

Gets the next stable parameter reference.

next_return

pub fn next_return(context: Context) -> reference.Return

Gets the next stable return reference.

next_supernode

pub fn next_supernode(context: Context) -> reference.Supernode

Gets the next stable supernode reference.