typeinfo

package
v0.24.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Overview

Package typeinfo describes tapestry autogenerated structures. It follows closely from tapestry typespecs: The typespecs describes the user specification ( in .ifspec, or .idl files ) while the typeinfo describes the golang structures derived from those specs. unless otherwise specified, names are in "lower_case" format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FriendlyName

func FriendlyName(n string) (ret string)

change one_two into "One two" fix: move to inflect?

Types

type Flow

type Flow struct {
	Name   string         // unique name for this type
	Lede   string         // the compact format leading text
	Slots  []*Slot        // interfaces that a command implements
	Terms  []Term         // terms of the command
	Markup map[string]any // metadata shared by all instances of this type
}

tbd: add groups to flow? ( and other types; maybe then a wrapped spec struct for Name, Groups, and Markup )

func (*Flow) TermIndex

func (t *Flow) TermIndex(name string) (ret int)

func (*Flow) TypeMarkup

func (t *Flow) TypeMarkup() map[string]any

func (*Flow) TypeName

func (t *Flow) TypeName() string

type Instance

type Instance interface {
	// returns the typeinfo for the instance
	TypeInfo() T
}

provides access to typeinfo for auto-generated commands

type Markup

type Markup interface {
	GetMarkup(ensure bool) map[string]any
}

implemented by instances with author specified markup data ( currently, that's only flows )

type Num

type Num struct {
	Name   string         // unique name for this type
	Markup map[string]any // metadata shared by all instances of this type
}

func (*Num) TypeMarkup

func (t *Num) TypeMarkup() map[string]any

func (*Num) TypeName

func (t *Num) TypeName() string

type Repeats

type Repeats interface {
	// slices can return false if their list is empty.
	Repeats() bool
}

a marker interface implemented by slices of commands

type Slot

type Slot struct {
	Name   string         // unique name for this type
	Markup map[string]any // metadata shared by all instances of this type
}

func (*Slot) TypeMarkup

func (t *Slot) TypeMarkup() map[string]any

func (*Slot) TypeName

func (t *Slot) TypeName() string

type Str

type Str struct {
	Name           string         // unique name for this type
	Options        []string       // for enumerations; for plain strings, this is nil.
	OptionComments []string       // matches options if there are comments; nil otherwise.
	Markup         map[string]any // metadata shared by all instances of this type
}

func (*Str) FindOption

func (t *Str) FindOption(str string) (ret int)

func (*Str) TypeMarkup

func (t *Str) TypeMarkup() map[string]any

func (*Str) TypeName

func (t *Str) TypeName() string

type T

type T interface {
	// globally unique name for the type.
	TypeName() string
	// returns markup data specified in the .tell spec
	// ( for instance: comments, blockly presentation information, etc. )
	TypeMarkup() map[string]any
}

implemented by each kind of typeinfo ( see: Flow, Slot, Str, and Num. )

type Term

type Term struct {
	Name     string         // go lang name; unique within its flow.
	Label    string         // the compact format signature
	Private  bool           // a member that only exists in memory; never serialized
	Optional bool           // true when the term can be omitted for instances of the flow.
	Repeats  bool           // true when the term can have multiple values ( all of the same type )
	Markup   map[string]any // per-term markup
	Type     T              // a pointer to Flow, Slot, Str, or Num; or, nil if private
}

a member of a Flow.

func (Term) IsAnonymous

func (t Term) IsAnonymous() bool

anonymous terms have empty labels. for instance, in some example command: { Say: "hello" } there is no label after the word say and before the first colon so that first term is considered anonymous.

type TypeSet

type TypeSet struct {
	Name       string
	Comment    []string // comments describing the entire package.
	Slot       []*Slot
	Flow       []*Flow
	Str        []*Str
	Num        []*Num
	Signatures map[uint64]Instance
}

package listing of type data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL