mixin

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 rt companion record

lib

Get the project companion lib

parse

Parse Xeto source representation into its rt rec AST representation

parseAxon

Parse Axon source representation into its rt rec AST representation

print

Print to Xeto source representation from its rt rec AST representation

printAxon

Print to Axon source representation from its rt rec AST representation

readAll

Read all companion rt records

readById

Read the companion rt record by id

readByName

Read the companion rt record by name

remove

Remove the companion rt rec from database

update

Replace an existing companion rt record by id

add abstract Dict add(Dict rec, Dict? opts := null)

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

  • id: Ref backdoor to explicitly set the new record id

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.

parse abstract Dict parse(Str xeto, Dict? meta := null)

Parse Xeto source representation into its rt rec AST representation. The optional meta parameter may be used to add additional tags into the rt record (such as carrying through the id tag).

parseAxon abstract Dict parseAxon(Str name, Str xeto, Dict? meta := null)

Parse Axon source representation into its rt rec AST representation.

print abstract Str print(Dict dict)

Print to Xeto source representation from its rt rec AST representation.

printAxon abstract Str printAxon(Dict dict)

Print to Axon source representation from its rt rec AST representation.

readAll abstract Dict[] readAll()

Read all companion rt records

readById abstract Dict? readById(Ref id, Bool checked := true)

Read the companion rt record by id. Raise exception or return null if id does not exist or does not map to companion rt rec.

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

Read the companion rt record by name. Raise exception or return null if name does not exist or does not map to companion rt rec.

remove abstract Void remove(Ref id)

Remove the companion rt rec from database. Raise exception if id does not map to a exisiting rt record. The namespace is reloaded on next access.

update abstract Dict update(Dict rec)

Replace an existing companion rt record by id. The given dict must match the AST respresentation as described in class header. Raise exception if no existing definition for the dict id. Return updated rt record. The namespace is reloaded on next access.

Haxall 4.0.6 ∙ 21-Jul-2026 09:48 EDT