Documentation
¶
Overview ¶
Package replext is where REPL features that need a translator or a transport register themselves, so a bare REPL links neither; replext/all links them all.
Index ¶
- func Drawer() docrender.DiagramDrawer
- func RegisterDrawer(d docrender.DiagramDrawer)
- func RegisterGraph(w GraphWriter)
- func RegisterNotation(w NotationWriter)
- func RegisterPositional(n PositionalNamer)
- func RegisterRepository(r Repository)
- type GraphWriter
- type LoadRequest
- type LoadResult
- type NotationWriter
- type PositionalDocument
- type PositionalNamer
- type ProjectInfo
- type ProjectState
- type PublishRequest
- type PublishResult
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Drawer ¶
func Drawer() docrender.DiagramDrawer
Drawer is the registered diagram drawer, nil when none is linked.
func RegisterDrawer ¶
func RegisterDrawer(d docrender.DiagramDrawer)
RegisterDrawer installs the drawer %render-document draws DOT diagrams with.
func RegisterGraph ¶
func RegisterGraph(w GraphWriter)
RegisterGraph installs the writer %features json uses.
func RegisterNotation ¶
func RegisterNotation(w NotationWriter)
RegisterNotation installs the writer %print and %save use.
func RegisterPositional ¶
func RegisterPositional(n PositionalNamer)
RegisterPositional installs the namer OSLC query identifies unnamed elements with.
func RegisterRepository ¶
func RegisterRepository(r Repository)
RegisterRepository installs the repository the %repo family of commands drives.
Types ¶
type GraphWriter ¶
type GraphWriter interface {
// DefaultInstances is how many objects a listing not asked for whole holds.
DefaultInstances() int
// Write is the JSON of inst's graph within depth and instances; warning, when
// the instance bound cut the graph short, is the diagnostic it carries.
// failures are the feature values the graph could not answer.
Write(ctx *runtime.Context, inst *runtime.Instance, index *symbols.Index, depth, instances int, warning func() string) (out []byte, failures []error, err error)
}
GraphWriter writes an object and what is reachable from it as the API's Instantiate response, for %features json.
func Graph ¶
func Graph() GraphWriter
Graph is the registered graph writer, nil when none is linked.
type LoadRequest ¶
LoadRequest picks the project and branch %load reads: a project by id or else by name, a branch by name or id or else the project's default.
type LoadResult ¶
type LoadResult struct {
State ProjectState
Notation []byte
Warnings []string
}
LoadResult is a loaded branch: its notation, ready to submit, and where it came from.
type NotationWriter ¶
type NotationWriter interface {
// Print is the prompt lines printing src, the session buffer named origin,
// through the writer a `.sysml` save writes with.
Print(origin string, src []byte) []string
// PrintElement is the prompt lines printing the source span covers in file;
// shown names the element in the line refusing a span with no notation.
PrintElement(file *source.SourceFile, span source.Span, shown string) []string
// Save writes src, the session buffer named origin, to path in the format
// its extension names, and is the lines reporting what it did. The error is
// only the write's own.
Save(origin string, src []byte, path string) ([]string, error)
}
NotationWriter prints the model as SysML notation and saves it in the format a file name selects, for %print and %save.
func Notation ¶
func Notation() NotationWriter
Notation is the registered notation writer, nil when none is linked.
type PositionalDocument ¶
type PositionalDocument struct {
File *source.SourceFile
Root *symbols.Scope
}
PositionalDocument pairs a session document with the scope holding its symbols.
type PositionalNamer ¶
type PositionalNamer func(index *symbols.Index, docs []PositionalDocument, identifies func(*symbols.Symbol) bool) (names map[*symbols.Symbol]string, byName map[string]*symbols.Symbol)
PositionalNamer names the symbols identifies refuses as the RDF export names them, by position, for OSLC query; byName is the inverse.
func Positional ¶
func Positional() PositionalNamer
Positional is the registered positional namer, nil when none is linked.
type ProjectInfo ¶
ProjectInfo names one project of a repository.
type ProjectState ¶
type ProjectState struct {
Base string // the server the state was read from
ProjectID string
ProjectName string
Branch string
BranchName string
LastSeenCommit string
}
ProjectState is the branch a session's model was loaded from or published to: what a later publish commits on top of. LastSeenCommit is the head the session last read or wrote.
type PublishRequest ¶
type PublishRequest struct {
Origin string
Source []byte
Root string
Project string
Branch string
Derived bool
State *ProjectState
}
PublishRequest publishes the elements rooted in one element of the session model: Root is its qualified name, Project the project name (the element's own name when empty), Branch the branch name (the default when empty), State the branch the session loaded the project from, if it did.
type PublishResult ¶
type PublishResult struct {
State ProjectState
Commit string
Created, Updated, Deleted int
NewProject bool
Notes []string
}
PublishResult is what a publish did: the project and branch it wrote, the commit it made (empty when the branch already agreed), and how many elements it created, updated and deleted. Created reports a project made anew.
type Repository ¶
type Repository interface {
// DefaultURL is the base URL a session starts with, from the environment.
DefaultURL() string
// CheckURL refuses a base URL the transport policy does not allow.
CheckURL(base string) error
// Projects lists every project, paged through completely.
Projects(ctx context.Context, base string) ([]ProjectInfo, error)
// Load reads a branch head as notation.
Load(ctx context.Context, base string, req LoadRequest) (*LoadResult, error)
// Publish writes the elements rooted in one element as a project or a commit.
Publish(ctx context.Context, base string, req PublishRequest) (*PublishResult, error)
}
Repository is what %repo, %projects, %load and %publish drive: a SysML v2 API server addressed by base URL. Commands that reach the network take the base URL every time, as %repo may change it between them.
func Repo ¶
func Repo() Repository
Repo returns the registered repository, nil when no binary linked one.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package all links every REPL feature replext lets a build leave out, so a REPL built with it serves every command the full `sysml` does.
|
Package all links every REPL feature replext lets a build leave out, so a REPL built with it serves every command the full `sysml` does. |
|
Package graphviz registers the drawer %render-document draws DOT diagrams with: the PDF backend's Graphviz, so the Markdown it prints carries the SVG a render on the command line writes.
|
Package graphviz registers the drawer %render-document draws DOT diagrams with: the PDF backend's Graphviz, so the Markdown it prints carries the SVG a render on the command line writes. |
|
Package instancegraph registers %features json: an object graph written as the API's Instantiate response, so a client reads one shape whether it asked the service or the REPL.
|
Package instancegraph registers %features json: an object graph written as the API's Instantiate response, so a client reads one shape whether it asked the service or the REPL. |
|
Package notation registers the REPL's %print and %save: the session's model written as SysML notation, or converted to the format a file name selects.
|
Package notation registers the REPL's %print and %save: the session's model written as SysML notation, or converted to the format a file name selects. |
|
Package positional registers the names OSLC query gives elements without a qualified identity: the positional `@N` identities the RDF export writes, so a query answers with the identifiers a saved graph holds.
|
Package positional registers the names OSLC query gives elements without a qualified identity: the positional `@N` identities the RDF export writes, so a query answers with the identifiers a saved graph holds. |
|
Package repository links the %repo, %projects, %load and %publish commands to a SysML v2 API server: any conformant one through the standard surface, with a bearer token from the environment when the server wants one.
|
Package repository links the %repo, %projects, %load and %publish commands to a SysML v2 API server: any conformant one through the standard surface, with a bearer token from the environment when the server wants one. |