type

ProjCompanion

const mixin ProjCompanion

Manage Xeto specs and instances in the project companion library

Spec record AST format:

  • rt: required to be "spec"
  • name: unique str name in companion lib
  • spec: must be @sys::Spec
  • base: ref qname for base type
  • slots: grid with cols: name, type ref, plus col for each meta
  • any other tags are spec meta
  • all type references must be a qname ref

Instance record AST format:

  • rt: required to be "instance"
  • name: unique str name in companion lib
  • spec: must be anything other than @sys::Spec
  • any other tags for instance data

methods

add

Add a new spec or instance to the companion lib.

func

Create dict AST respresentation for an Axon function

lib

Get the project companion lib.

list

List all records for companion lib specs and instances

parse

Parse the Xeto source representation into its dict AST representation.

print

Print the Xeto source representation from its dict AST representation.

read

Read the record for the given companion lib spec or instance

remove

Remove the spec or instance definition by name from companion lib.

rename

Rename an existing spec or instance in the companion lib.

update

Update an existing spec or instance to the companion lib.

Slot Details

add

abstract Void add(Dict rec)

Add a new spec or instance to the companion lib. The given dict must match the AST respresentation as described in class header. Raise exception if a definition already exists for the defined name. The namespace is reloaded on next access.

func

abstract Dict func(Str name, Str axon, Dict meta := Etc.dict0())

Create dict AST respresentation for an Axon function

lib

abstract Lib? lib(Bool checked := true)

Get the project companion lib. If the companion lib cannot be compiled then return null or raise exception based on checked flag.

list

abstract Dict[] list()

List all records for companion lib specs and instances

parse

abstract Dict parse(Str xeto)

Parse the Xeto source representation into its dict AST representation.

print

abstract Str print(Dict dict)

Print the Xeto source representation from its dict AST representation.

read

abstract Dict? read(Str name, Bool checked := true)

Read the record for the given companion lib spec or instance

remove

abstract Void remove(Str name)

Remove the spec or instance definition by name from companion lib. Ignore this call if there is no definition for name. The namespace is reloaded on next access.

rename

abstract Void rename(Str oldName, Str newName)

Rename an existing spec or instance in the companion lib. Raise exception if no existing definition for oldName or newName already exists. The namespace is reloaded on next access.

update

abstract Void update(Dict rec)

Update an existing spec or instance to the companion lib. The given dict must match the AST respresentation as described in class header. Raise exception if no existing definition for name. The namespace is reloaded on next access. If id/mod tags are passsed then they must match the existing record in database.