Documentation
¶
Index ¶
- Constants
- func DeclaredMetadata(node Node) (prefixes []*PrefixMetadata, body []Node, ok bool)
- func Dump(n Node) string
- func EffectiveName(u *Usage) (string, source.Span)
- func IsEntryAction(actions []Node, decl Node) bool
- func IsSuccessionSource(member Node) bool
- func Notation(node Node) string
- func QualifiedText(node Node) string
- func SimpleName(node Node) string
- func TargetName(node Node) (string, source.Span)
- type AcceptActionUsage
- type AcceptEvent
- type ActionExecutionNode
- type Alias
- type AssignmentActionNode
- type AssumeMember
- type BodyExpr
- type BodyParam
- type CallEvent
- type CastExpr
- type ChangeEvent
- type CollectExpr
- type Comment
- type ConnectorEnd
- type ConstraintMember
- type ConstructorExpr
- type ControlFlowEdge
- type CrossFeatureMember
- type DecisionNode
- type DeferMember
- type Definition
- type DefinitionKind
- type Dependency
- type DoMember
- type Documentation
- type EntryMember
- type ErrorNode
- type ExitMember
- type FeatureChainExpr
- type FeatureDirection
- type FeatureReference
- type FilterMember
- type FinalNode
- type FlowEnds
- type ForkNode
- type Identification
- type IfActionNode
- type IfBranchKind
- type IfBranchNode
- type Import
- type ImportKind
- type IndexExpr
- type InitialNode
- type InvocationExpr
- type JoinNode
- type LiteralBool
- type LiteralInfinity
- type LiteralInteger
- type LiteralReal
- type LiteralString
- type LoopKind
- type Membership
- type MergeNode
- type MetadataAccessExpr
- type Multiplicity
- type MultiplicityDecl
- type NameSegment
- type NamedArg
- type Namespace
- type Node
- type NodeBase
- type NullExpr
- type ObjectFlowEdge
- type OperatorExpr
- type OperatorKind
- type OwnedConstraint
- type Package
- type PerformActionNode
- type PortionKind
- type PrefixMetadata
- type PseudostateKind
- type PseudostateNode
- type QualifiedName
- type Relationship
- type RelationshipKind
- type RelationshipMember
- type RequireMember
- type RootNamespace
- type SelectExpr
- type SendStatement
- type SequenceExpr
- type StateNode
- type StateRegion
- type SubjectMember
- type SubstateMember
- type SuccessionEdge
- type TerminateStatement
- type TextualRepresentation
- type TimeEvent
- type TransitionEdge
- type TransitionMember
- type TriggerEvent
- type Trivia
- type TriviaKind
- type Usage
- type UsageKind
- type Visibility
- type WhileLoopActionNode
Constants ¶
const DoneFeature = "done"
DoneFeature is the name of the end shot every state inherits from the standard library (`Systems Library/States.sysml`), which a transition enters to complete.
Variables ¶
This section is empty.
Functions ¶
func DeclaredMetadata ¶ added in v0.5.0
func DeclaredMetadata(node Node) (prefixes []*PrefixMetadata, body []Node, ok bool)
DeclaredMetadata returns the prefix metadata a declaration is written with and the body whose metadata members annotate it (KerML 8.2.4 PrefixMetadataMember; SysML.xtext UsageExtensionKeyword on SubjectUsage and RequirementConstraintUsage). A document root's members annotate the root namespace, and an annotation's body members annotate the annotation itself. ok is false for a node that carries neither.
func EffectiveName ¶
EffectiveName returns the name a usage answers to: its declared name, else the name its naming feature supplies.
func IsEntryAction ¶ added in v0.1.1
IsEntryAction reports whether decl is one of the actions.
func IsSuccessionSource ¶ added in v0.5.0
IsSuccessionSource reports whether a positional `then` sequences from this body member: a feature that is not an edge (SysML v2 §7.17.4). Parser and RDF writer share it.
func Notation ¶ added in v0.4.1
Notation names a declaration the way the notation writes it — "part def", "datatype", "assert constraint" — and is empty for a node the notation has no keyword of its own for.
func QualifiedText ¶ added in v0.4.2
QualifiedText renders a reference's whole name as written ("A::B::C"), or "" when node names nothing.
func SimpleName ¶
SimpleName returns a reference's last segment — the name the resolver and the runtime match on — or "" when node names nothing.
Types ¶
type AcceptActionUsage ¶
type AcceptActionUsage struct {
NodeBase
Name string
ParamName string
ParamType *QualifiedName
}
AcceptActionUsage represents an action that waits for a signal. Syntax: action <name> accept <param> : Type;
type AcceptEvent ¶
type AcceptEvent struct {
NodeBase
SignalType *QualifiedName // signal type to accept
// Subsets is the event feature the payload parameter subsets
// (`accept :> shutDown`), nil when it subsets none.
Subsets *QualifiedName
// Payload is the payload parameter as it was declared, when the accept named
// one (`accept msg : Warning`), so the name the received value binds to
// survives lowering.
Payload *Usage
}
AcceptEvent fires when a signal is received. It is the lowered form of the payload parameter of an accept (SysML.xtext `PayloadParameter`), whose three spellings this node keeps apart:
accept Warning — SignalType, an unnamed payload typed by Warning accept msg : Warning — SignalType with Payload naming the parameter accept :> shutDown — Subsets, the event feature accepted
Subsetting an event accepts occurrences of *that feature* rather than of a type, so the two are matched differently and are recorded separately.
type ActionExecutionNode ¶
type ActionExecutionNode struct {
NodeBase
Name string
ActionRef *QualifiedName // reference to nested action (mutually exclusive with Expression)
Expression Node // inline expression (mutually exclusive with ActionRef)
}
ActionExecutionNode performs action work: invokes nested action or evaluates inline expression.
type Alias ¶
type Alias struct {
NodeBase
Visibility Visibility
Ident Identification
For *QualifiedName
Body []Node
HasBody bool
}
Alias is `alias <shortName> name for QualifiedName ;|{}`.
type AssignmentActionNode ¶
type AssignmentActionNode struct {
NodeBase
Target Node // feature reference or qualified name
Value Node // expression to assign
}
AssignmentActionNode represents an assignment statement: assign target := value;
type AssumeMember ¶
type AssumeMember struct {
NodeBase
// Prefix metadata written before the declaration: `assume #goal constraint c;`.
Prefixes []*PrefixMetadata
Expression Node // the reference the member states, when written as one
Reference *QualifiedName // referenced constraint/requirement (reference-subsetting form)
Body []Node // ConstraintMembers of the nested constraint (for the braced form)
// Declaration of the constraint the member owns, when it is written with
// one: `assume constraint <c> c1 : C;`. DeclSpan covers it from `constraint` on.
Ident Identification
DeclSpan source.Span
Relationships []*Relationship
Multiplicity *Multiplicity
Value Node
// ValueOperatorSpan covers the value operator; ValueIsDefault and
// ValueIsInitial are its `default` and `:=` (KerML FeatureValue).
ValueOperatorSpan source.Span
ValueIsDefault bool
ValueIsInitial bool
// HasBody records that the member was written with braces, which an empty
// body does not otherwise show.
HasBody bool
}
AssumeMember represents an assumption in a requirement body. Syntax: assume <reference>; OR assume constraint { <expression>... } OR assume <Q::r> { body }
type BodyExpr ¶
type BodyExpr struct {
NodeBase
Params []BodyParam
// Members are the body's documentation and the features it declares ahead
// of its result: `private attribute lbcf = …;`.
Members []Node
Result Node
}
BodyExpr is `{ [doc] (in param ;)* (member)* resultExpr }`.
type BodyParam ¶
type BodyParam struct {
Name string
Type *QualifiedName // optional type annotation (e.g., in x : Type)
Multiplicity *Multiplicity // optional multiplicity after type (e.g., in x : Type [1])
Value Node // optional default value (e.g., in x = expr)
IsReference bool // true if 'ref' modifier present
Members []Node // optional body members (e.g., in x { doc ... })
// Relationships are the specializations the parameter declares other than
// its typing, which Type carries: `in p :> ISQ::mass` subsets a feature
// rather than naming a type.
Relationships []*Relationship
Span source.Span
}
BodyParam is `in name` inside a body expression.
type CallEvent ¶
type CallEvent struct {
NodeBase
Operation *QualifiedName // operation to invoke
Parameters []NameSegment // declared argument names, in written order
}
CallEvent fires when an operation is invoked. Parameters are the argument names the trigger declares (`accept op(speed)`); an empty list matches a call to that operation whatever arguments it carries.
type CastExpr ¶
type CastExpr struct {
NodeBase
TargetType *QualifiedName
Multiplicity *Multiplicity
}
CastExpr represents a type cast: (as Type) or (as Type[mult])
type ChangeEvent ¶
ChangeEvent fires when a condition becomes true.
type CollectExpr ¶
CollectExpr is `operand . body`.
type Comment ¶
type Comment struct {
NodeBase
Ident Identification
About []*QualifiedName
Locale string
BodySpan source.Span // the REGULAR_COMMENT token span
}
Comment is `[comment <id> [about refs]] [locale s] /* ... */`.
type ConnectorEnd ¶
type ConnectorEnd struct {
NodeBase
Target Node // QualifiedName or Expression (e.g., FeatureChainExpr for occ.startShot)
Multiplicity *Multiplicity
Reference Node // Optional "references X" clause - QualifiedName or FeatureChainExpr
Relationships []*Relationship // Optional relationships (e.g., ::> for interface binding)
}
ConnectorEnd represents a single connector end with optional multiplicity.
func (*ConnectorEnd) AttachedTarget ¶
func (c *ConnectorEnd) AttachedTarget() Node
AttachedTarget returns the node naming the feature this end attaches to: what it reference-subsets when it declares a name of its own (`connect bead references t.bead`), and the target it names otherwise (`connect a.p to b.q`).
func (*ConnectorEnd) DeclaredName ¶
func (c *ConnectorEnd) DeclaredName() (Identification, bool)
DeclaredName returns the name the end declares for itself, and whether it declares one at all. A connector end names an end feature of the connector only when it also reference-subsets the feature that end attaches to (`connect bead references t.bead`, `connect supplierPort ::> a.p`); without that clause the end names an existing feature instead (`connect a to b`).
func (*ConnectorEnd) ReferencedTarget ¶
func (c *ConnectorEnd) ReferencedTarget() Node
ReferencedTarget returns the node naming the feature the end reference-subsets (`references x`, `::> x`), or nil when the end has no such clause.
type ConstraintMember ¶
type ConstraintMember struct {
NodeBase
IsAssert bool // true for 'assert', false for 'assume'
// Keyword is the keyword the condition was written with: "assert",
// "assume", or "" for a bare condition, which asserts implicitly.
Keyword string
IsNegated bool // true if 'not' keyword present (assert not expr)
Expression Node // the constraint expression, nil when stated through Body
Name string // name of the nested constraint, when it has one
Body []Node // conditions of a nested constraint: assert constraint { <expr> }
}
ConstraintMember represents a condition of a constraint body. Syntax: <expression> or assert [not] <reference>; or assert constraint { … }
type ConstructorExpr ¶
type ConstructorExpr struct {
NodeBase
Type *QualifiedName
Args []Node
NamedArgs []NamedArg
}
ConstructorExpr is `new Type ( args )`, with positional or named arguments.
type ControlFlowEdge ¶
type ControlFlowEdge struct {
NodeBase
Source *QualifiedName // source node (typically DecisionNode)
Target *QualifiedName // target node
Guard Node // boolean guard expression, nil for the default branch
// IsElse records that the edge was written as the `else <target>;` branch of
// a decision (SysML.xtext DefaultTargetSuccession), the branch taken when no
// guarded branch of the same decision is.
IsElse bool
// SourceMember and TargetMember bind an end by position rather than by name,
// as on SuccessionEdge: the branches of a decision node the body declares
// without a name (`then decide; if x then a; else b;`) reach it this way.
SourceMember Node
TargetMember Node
// SourceImplied and TargetImplied mark an end the notation supplied rather
// than the author writing it, as on SuccessionEdge.
SourceImplied bool
TargetImplied bool
}
ControlFlowEdge is guarded control flow from decision nodes.
type CrossFeatureMember ¶ added in v0.2.0
type CrossFeatureMember struct {
NodeBase
Ident Identification
Multiplicity *Multiplicity
Relationships []*Relationship
}
CrossFeatureMember is the cross feature declared inline by an end feature, the `x1 [0..1]` of `end x1 [0..1] feature x : C1` (KerML 8.3.4.5).
type DecisionNode ¶
type DecisionNode struct {
NodeBase
Name string
NameSpan source.Span // span of Name, empty for an unnamed node
Members []Node // body members, as on ForkNode
HasBody bool
}
DecisionNode is a conditional branch point (1 incoming → N guarded outgoing).
type DeferMember ¶
DeferMember represents the events a state defers while it is active. Syntax: defer <event> [, <event>]* ;
type Definition ¶
type Definition struct {
NodeBase
Prefixes []*PrefixMetadata
Kind DefinitionKind
// Keyword is the kind keyword as written, kept for the same reason as
// Usage.Keyword.
Keyword string
// HasDefKeyword records the `def` of a SysML `part def`, which a KerML
// classifier declaration of the same kind is written without.
HasDefKeyword bool
IsAbstract bool
IsVariation bool
IsAll bool // 'all' multiplicity propagation modifier
IsConstant bool // 'constant' feature modifier
IsEvent bool // 'event' modifier for event-driven occurrences
IsIndividual bool // 'individual' modifier: `individual part def` (SysML v2 8.3.9.11)
// IsParallel is the `parallel` before a state body: the state's substates
// are orthogonal (SysML v2 StateDefinition::isParallel).
IsParallel bool
Visibility Visibility
Ident Identification
Multiplicity *Multiplicity
Relationships []*Relationship
Members []Node
HasBody bool
}
Definition is a `part def` / `attribute def` (and future kinds) node.
type DefinitionKind ¶
type DefinitionKind int
DefinitionKind discriminates the concrete definition taxonomy element.
const ( DefPart DefinitionKind = iota DefAttribute // Tier A — pure keyword-swaps of the part/attribute pattern. DefItem DefOccurrence DefIndividual DefMetaclass DefMetadata DefEnumeration DefView DefViewpoint DefRendering DefConcern // Tier B — distinctive declaration grammar. DefConnection DefFlow DefPort DefInterface DefAllocation DefBinding // Tier C — nested behavioral bodies (generic body this cycle). DefAction DefState DefCalc DefConstraint DefRequirement DefCase DefAnalysisCase DefVerificationCase DefUseCase // KerML structural kinds DefBehavior DefAssoc DefStruct DefClass DefPredicate DefBool )
func (DefinitionKind) String ¶
func (k DefinitionKind) String() string
type Dependency ¶
type Dependency struct {
NodeBase
Prefixes []*PrefixMetadata
Ident Identification
Clients []*QualifiedName
Suppliers []*QualifiedName
Body []Node
HasBody bool
}
Dependency is `dependency [<id> from] clients to suppliers ;|{}`.
type Documentation ¶
type Documentation struct {
NodeBase
Ident Identification
Locale string
BodySpan source.Span
}
Documentation is `doc <id> [locale s] /* ... */`.
type EntryMember ¶
EntryMember represents entry behavior in a state body. Syntax: entry { <actions> }
type ErrorNode ¶
ErrorNode represents a span of source the parser could not parse into a valid construct. The parser always produces a tree; unparseable regions become ErrorNodes so downstream tooling (LSP) still gets a partial tree.
type ExitMember ¶
ExitMember represents exit behavior in a state body. Syntax: exit { <actions> }
type FeatureChainExpr ¶
type FeatureChainExpr struct {
NodeBase
Operand Node
Member *QualifiedName
}
FeatureChainExpr is `operand . member` (feature chain access).
type FeatureDirection ¶
type FeatureDirection int
FeatureDirection is the in/out/inout direction modifier on a usage.
const ( DirNone FeatureDirection = iota DirIn DirOut DirInOut )
func (FeatureDirection) String ¶
func (d FeatureDirection) String() string
type FeatureReference ¶
type FeatureReference struct {
NodeBase
Name *QualifiedName
}
FeatureReference is a bare QualifiedName used as an expression.
type FilterMember ¶
FilterMember is an `filter <expression> ;` element filter.
type FinalNode ¶
type FinalNode struct {
NodeBase
}
FinalNode is the termination point for action execution.
type FlowEnds ¶
type FlowEnds struct {
NodeBase
From Node // Flow source (qualified name or feature chain)
To Node // Flow target (qualified name or feature chain)
Payload Node // optional; from the `of` clause (qualified name or feature chain)
// PayloadDecl is set when the `of` clause declares the payload feature
// (`of name : Type`) instead of referring to an existing one. That usage is
// also a member of the owning flow, and Payload names it.
PayloadDecl *Usage
// PayloadMultiplicity is the multiplicity stated with a payload type that
// declares no feature of its own (`of Publish[1]`, `of [1] Publish`). Where
// the payload is a declaration the multiplicity is that usage's own.
PayloadMultiplicity *Multiplicity
}
FlowEnds holds the ends of a flow usage: the `from`/`to` targets and an optional payload from the `of` clause. It embeds NodeBase (spannable) but is only ever reached through the *ast.Usage traversal case.
type ForkNode ¶
type ForkNode struct {
NodeBase
Name string
NameSpan source.Span // span of Name, empty for an unnamed node
// Members and HasBody carry the body every ControlNode may declare
// (SysML.xtext ControlNode: `UsageDeclaration? ActionBody`), which is where
// the node's parameters are written (`fork F { in a; out b; }`).
Members []Node
HasBody bool
}
ForkNode splits execution into concurrent flows (1 incoming → N outgoing).
type Identification ¶
type Identification struct {
ShortName string
ShortNameSpan source.Span
Name string
NameSpan source.Span
}
Identification captures `<shortName> name` or `name` on a declaration.
type IfActionNode ¶
type IfActionNode struct {
NodeBase
Condition Node // boolean expression
Then *IfBranchNode // branch taken when the condition holds
Else *IfBranchNode // branch taken otherwise (nil when there is no else)
}
IfActionNode represents conditional: if condition { thenBody } else { elseBody }
func (*IfActionNode) Branches ¶
func (n *IfActionNode) Branches() []*IfBranchNode
Branches returns the branches the conditional declares, in source order, skipping an absent else.
type IfBranchKind ¶
type IfBranchKind int
IfBranchKind discriminates the two branches of an if action.
const ( // IfBranchThen is the branch taken when the condition holds. IfBranchThen IfBranchKind = iota // IfBranchElse is the branch taken when it does not. IfBranchElse )
func (IfBranchKind) String ¶
func (k IfBranchKind) String() string
String renders the branch's introducing keyword.
type IfBranchNode ¶
type IfBranchNode struct {
NodeBase
Kind IfBranchKind
Body []Node // statements in the branch body
}
IfBranchNode is the body of one branch of an if action. It exists so that a branch is an element in its own right: the declarations a branch body makes are members of the branch, not of the enclosing behavior, and only a node can own a scope.
type Import ¶
type Import struct {
NodeBase
Visibility Visibility
IsAll bool
Kind ImportKind
Imported *QualifiedName
IsRecursive bool // `::**`
FilterExpr Node // Optional filter expression [<expr>]
Body []Node
HasBody bool
// IsExpose marks an `expose` declaration. Per SysML v2 8.3.26.2 an Expose
// always imports all elements regardless of visibility (isImportAll = true)
// and always has protected visibility, so IsAll and Visibility are fixed
// accordingly by the parser.
IsExpose bool
}
Import is `[visibility] import [all] QualifiedName[::*][::**] ;|{}`.
An `expose` declaration in a view body is also an Import: SysML v2 8.3.26.2 makes Expose a specialization of Import (MembershipExpose specializes MembershipImport, NamespaceExpose specializes NamespaceImport), so it is represented by this node with IsExpose set.
type ImportKind ¶
type ImportKind int
ImportKind distinguishes membership vs namespace imports.
const ( ImportMembership ImportKind = iota // import A::B ; ImportNamespace // import A::B::* ; )
type IndexExpr ¶
type IndexExpr struct {
NodeBase
Operand Node
Index Node
Bracket bool // written `operand [ seq ]`
}
IndexExpr is `operand # ( seq )` or `operand [ seq ]`. The two are distinct syntaxes: bracket form is the quantity operator, which pairs a magnitude with a measurement reference, while `#` indexes a sequence.
type InitialNode ¶
type InitialNode struct {
NodeBase
Name string // optional identifier for edge referencing
NameSpan source.Span // span of Name, empty when none is written
Successor *QualifiedName // optional target for implicit succession (from `first X then Y` syntax)
Guard Node // optional guard condition for succession
// Members are the members of the body the succession was written with
// (`first start then continue { … }`), and HasBody that it was written with
// one rather than ended by ';'.
Members []Node
HasBody bool
}
InitialNode is the entry point for action execution.
type InvocationExpr ¶
type InvocationExpr struct {
NodeBase
Operand Node // receiver for `->` form, else nil
Type *QualifiedName // instantiated type
Args []Node // positional args (Argument) or ...
NamedArgs []NamedArg // named args, mutually exclusive with Args
}
InvocationExpr is `Type ( args )` or `operand -> Type ( args | body | funcref )`.
type JoinNode ¶
type JoinNode struct {
NodeBase
Name string
NameSpan source.Span // span of Name, empty for an unnamed node
Members []Node // body members, as on ForkNode
HasBody bool
}
JoinNode synchronizes concurrent flows (N incoming → 1 outgoing).
type LiteralInfinity ¶
type LiteralInfinity struct{ NodeBase }
LiteralInfinity is `*` in an expression position.
type LiteralInteger ¶
LiteralInteger is a DECIMAL_VALUE literal (raw text).
type LiteralReal ¶
LiteralReal is a RealValue literal (raw text).
type LiteralString ¶
LiteralString is a double-quoted string literal (raw token text, quotes included).
type LoopKind ¶
type LoopKind int
LoopKind discriminates the loop forms, which share one node because they share a body and a condition but differ in when the condition is tested.
const ( // LoopWhile is `while <cond> { body }`: the condition is tested before every // iteration, so a body may run zero times. LoopWhile LoopKind = iota // LoopUntil is `loop { body } until <cond>;`: the condition is tested after // every iteration, so the body runs at least once. A loop written without an // `until` clause has no condition and iterates until the step budget stops it. LoopUntil // LoopFor is `for <var> in <collection> { body }`: the body runs once per // element of the collection, with the element bound to the loop's variable. LoopFor )
type Membership ¶
type Membership struct {
NodeBase
Visibility Visibility
IsTypeFeature bool
Member Node
}
Membership wraps a namespace member with a visibility prefix. Member is the owned element (a Package/Namespace/Dependency/Comment/... or ErrorNode). A `then` prefixing a member is not recorded here: it sequences the members either side of it rather than describing one of them, so the parser desugars it to a SuccessionEdge of its own (see internal/core/parser/succession.go).
type MergeNode ¶
type MergeNode struct {
NodeBase
Name string
NameSpan source.Span // span of Name, empty for an unnamed node
Members []Node // body members, as on ForkNode
HasBody bool
}
MergeNode merges alternative flows (N incoming → 1 outgoing, first-wins).
type MetadataAccessExpr ¶
type MetadataAccessExpr struct {
NodeBase
Ref *QualifiedName
}
MetadataAccessExpr is `ref . metadata`.
type Multiplicity ¶
Multiplicity is a `[n]` / `[lo..hi]` / `[*]` bound on a usage. Bounds are expression Nodes (reusing the expression AST); `*` becomes LiteralInfinity. For the single-bound form `[n]`, Upper holds n and IsRange is false.
type MultiplicityDecl ¶
type MultiplicityDecl struct {
NodeBase
Ident Identification
Range *Multiplicity // range bounds, in the MultiplicityRange form
// Subsets is the subsetted multiplicity of a MultiplicitySubset; the two
// forms are exclusive.
Subsets *QualifiedName
Members []Node // optional - body members (typically doc comments)
HasBody bool // true if has {}, false if just ;
}
MultiplicityDecl is `multiplicity <id> [range] ;|{}` (a MultiplicityRange) or `multiplicity <id> subsets f ;|{}` (a MultiplicitySubset, KerML.xtext:754). Declares a named multiplicity like exactlyOne [1..1].
type NameSegment ¶
type NameSegment struct {
Text string
Span source.Span
// Chained records that the segment was written after '.' rather than after
// '::': a feature chain step (`S2.S3`) rather than a namespace member.
Chained bool
}
NameSegment is one identifier in a qualified name, with its source span. It carries no semantic information: the symbol a segment resolves to lives in the resolver's side table, reachable through Resolver.PartSymbol.
type NamedArg ¶
type NamedArg struct {
Name *QualifiedName
Value Node
}
NamedArg is `name = value` in an argument list.
type Namespace ¶
type Namespace struct {
NodeBase
Prefixes []*PrefixMetadata
Ident Identification
Members []Node
HasBody bool // false when body was `;`
}
Namespace is `namespace <id> { ... }`.
type Node ¶
Node is the common interface for every AST/CST node. The tree is syntax-only and immutable after parsing; all semantic information (resolved references, types) lives in side tables keyed by node, added in later plans.
func EntryActions ¶ added in v0.1.1
EntryActions returns the actions the entry subactions among a state body's members declare, in declaration order.
func NodeBodyMembers ¶ added in v0.2.0
NodeBodyMembers returns the members of the body an action node declares, and nil for a node that declares no body or admits none.
func StateEntryActions ¶ added in v0.1.1
StateEntryActions returns the entry actions of a state declaration, whichever shape it was parsed into: a state node's entry behavior or a body's `entry`.
type NodeBase ¶
NodeBase is embedded by every concrete node to provide span + trivia storage and satisfy the Node interface's accessor methods.
func (*NodeBase) LeadingTrivia ¶
func (*NodeBase) SetLeadingTrivia ¶
func (*NodeBase) SetTrailingTrivia ¶
func (*NodeBase) TrailingTrivia ¶
type ObjectFlowEdge ¶
type ObjectFlowEdge struct {
NodeBase
Source *QualifiedName // source pin/parameter
Target *QualifiedName // target pin/parameter
}
ObjectFlowEdge is data flow between action parameters/pins (Tier 5).
type OperatorExpr ¶
type OperatorExpr struct {
NodeBase
Operator OperatorKind
Operands []Node
TypeRef *QualifiedName // classification/cast RHS, else nil
}
OperatorExpr is any operator application. Operands has 3 elements for OpConditional (cond, then, else), 1 for unary/extent, 2 otherwise. For OpAt/OpMetaAt/OpAs/OpMeta the RHS type reference is stored in TypeRef.
type OperatorKind ¶
type OperatorKind int
OperatorKind enumerates every operator in the KerMLExpressions ladder, used by OperatorExpr regardless of arity.
const ( OpInvalid OperatorKind = iota OpConditional // if C ? A else B OpNullCoalesce // ?? OpImplies // implies OpOr // | OpConditionalOr // or OpXor // xor OpAnd // & OpConditionalAnd // and OpEq // == OpNeq // != OpEqEqEq // === OpNeqEqEq // !== OpHasType // hastype OpIsType // istype OpAt // @ OpMetaAt // @@ OpAs // as OpMeta // meta OpLt // < OpGt // > OpLe // <= OpGe // >= OpRange // .. OpAdd // + OpSub // - OpMul // * OpDiv // / OpMod // % OpPow // ** or ^ OpNeg // unary - OpPos // unary + OpBitNot // unary ~ OpNot // unary not OpAll // extent: all OpIndex // [ ... ] )
func (OperatorKind) String ¶
func (k OperatorKind) String() string
type OwnedConstraint ¶ added in v0.5.0
type OwnedConstraint struct {
Ident Identification
DeclSpan source.Span
Relationships []*Relationship
Multiplicity *Multiplicity
Value Node
ValueOperatorSpan source.Span
ValueIsDefault bool
ValueIsInitial bool
Body []Node
}
OwnedConstraint is the constraint usage an assume or require member declares with the `constraint` keyword (SysML.xtext RequirementConstraintUsage).
func OwnedConstraintOf ¶ added in v0.5.0
func OwnedConstraintOf(n Node) (OwnedConstraint, bool)
OwnedConstraintOf returns the constraint an assume or require member declares, or false for one that references a requirement or states a condition instead.
func (OwnedConstraint) EffectiveName ¶ added in v0.5.0
func (c OwnedConstraint) EffectiveName() (string, source.Span)
EffectiveName returns the name the constraint answers to: its declared name, else the name its naming feature supplies.
func (OwnedConstraint) NamingFeature ¶ added in v0.5.0
func (c OwnedConstraint) NamingFeature() *Relationship
NamingFeature returns the relationship naming a constraint declared without a name, as NamingFeature does for a usage; a short name alone is not a declared name (KerML derives effectiveName from declaredName), so it leaves it in place.
type Package ¶
type Package struct {
NodeBase
Prefixes []*PrefixMetadata
Ident Identification
IsLibrary bool
IsStandard bool
Members []Node
HasBody bool
}
Package is `package <id> { ... }`. Library/Standard flags cover `library package` and `standard library package`.
type PerformActionNode ¶
type PerformActionNode struct {
NodeBase
ActionRef Node // qualified name or invocation expression
}
PerformActionNode represents a perform statement: perform action;
func (*PerformActionNode) PerformedInvocation ¶ added in v0.5.0
func (n *PerformActionNode) PerformedInvocation() *InvocationExpr
PerformedInvocation is the call the statement performs (`perform tag(x);`); nil when it names the action without arguments.
type PortionKind ¶
type PortionKind int
PortionKind is the portion an occurrence usage declares of its type (OccurrenceUsage::portionKind, SysML v2 8.3.9.11).
const ( PortionNone PortionKind = iota PortionSnapshot PortionTimeslice )
func (PortionKind) Keyword ¶
func (k PortionKind) Keyword() string
Keyword returns the notation for the portion kind, empty for PortionNone.
type PrefixMetadata ¶
type PrefixMetadata struct {
NodeBase
// Ident names the usage when it declares one before its typing:
// `@ m : Meta;`, `@ : Meta;` (SysML.xtext MetadataUsageDeclaration).
Ident Identification
Type *QualifiedName
Body []Node // optional body with property initializers: @Meta{prop = value;}
// HasBody records that the usage was written with braces, which an empty
// body does not otherwise show.
HasBody bool
// Elements the usage annotates: `@Meta about a, b;` (SysML.xtext:145-147).
About []*QualifiedName
}
PrefixMetadata records a `# QualifiedName` metadata annotation reference.
type PseudostateKind ¶
type PseudostateKind int
PseudostateKind discriminates pseudostate types.
const ( PseudostateChoice PseudostateKind = iota // conditional branch PseudostateJunction // merge point PseudostateFork // parallel split PseudostateJoin // parallel sync PseudostateEntry // entry point (submachine) PseudostateExit // exit point (submachine) // PseudostateShallowHistory re-enters the substate of its composite state // that was active when that state was last exited. PseudostateShallowHistory // PseudostateDeepHistory re-enters the innermost substate that was active // when its composite state was last exited. PseudostateDeepHistory )
func (PseudostateKind) String ¶
func (k PseudostateKind) String() string
type PseudostateNode ¶
type PseudostateNode struct {
NodeBase
Kind PseudostateKind
Name string
// Keyword is the notation the pseudostate was written with (`choice`,
// `deep history`, `entry point`, `fork`).
Keyword string
}
PseudostateNode is a transient state for control flow.
type QualifiedName ¶
type QualifiedName struct {
NodeBase
Global bool
Parts []NameSegment
// contains filtered or unexported fields
}
QualifiedName is an unresolved dotted/`::`-separated name reference. Global is true when the name began with `$::`.
func AsQualifiedName ¶
func AsQualifiedName(node Node) *QualifiedName
AsQualifiedName unwraps the two forms a name reference parses to: a bare QualifiedName, or one wrapped in a FeatureReference. It returns nil for anything else.
func (*QualifiedName) SetSingleton ¶ added in v0.4.2
func (q *QualifiedName) SetSingleton(seg NameSegment)
SetSingleton makes seg the name's only part, backed by the node's own storage. The slice is capped so appending a later segment copies out.
type Relationship ¶
type Relationship struct {
NodeBase
Kind RelationshipKind
Target Node // QualifiedName or Expression (e.g., FeatureChainExpr for interfacingPorts.incomingTransfers)
// Conjugated records the `~` of a ConjugatedPortTyping (SysML v2
// 8.3.12.3): the type is the conjugate of Target, which reverses the
// directions of the target port definition's features.
Conjugated bool
}
Relationship is one specialization/typing edge: exactly one Target. A clause with multiple targets (`specializes A, B`) produces multiple Relationship entries sharing the same Kind.
func DeclNamingFeature ¶ added in v0.5.0
func DeclNamingFeature(decl Node) *Relationship
DeclNamingFeature is NamingFeature over every declaration that may borrow its name: a usage, a requirement subject or an assume/require constraint.
func NamingFeature ¶
func NamingFeature(u *Usage) *Relationship
NamingFeature returns the relationship that names a usage lacking a declared name (KerML 7.3.4.5): its reference subsetting, else its lone redefinition. A usage that declares a name, or redefines more than one feature, has none. A declared short name is no name here: KerML derives effectiveName from declaredName alone.
func SplitRedefinitions ¶
func SplitRedefinitions(rels []*Relationship) (redefines, others []*Relationship)
SplitRedefinitions partitions rels into the redefinitions and the rest, which resolve in different scopes when owned by a connector end.
type RelationshipKind ¶
type RelationshipKind int
RelationshipKind discriminates a specialization/typing edge at a definition or usage declaration head.
const ( RelTyping RelationshipKind = iota // ':' / 'defined by' RelSpecializes // 'specializes' / ':>' RelSubsets // 'subsets' / ':>' RelRedefines // 'redefines' / ':>>' // RelReferences models a KerML ReferenceSubsetting: the single owned // subsetting a feature may syntactically distinguish with 'references' / // '::>' (KerML 8.3.3.3.9). The 'via', 'about' and 'by' clauses of accept // actions, metadata usages and satisfy usages name related elements // without subsetting them, so they carry their own kinds below. RelReferences // 'references' / '::>' RelCrosses // 'crosses' / '=>' RelDisjoint // 'disjoint from' RelIntersects // 'intersects' RelInverseOf // 'inverse of' RelUnions // 'unions' RelChains // 'chains' RelIncludes // 'includes' (use case inclusion) RelVia // 'via' (accept action receiving port) RelAnnotates // 'about' (metadata annotated element) RelSubject // 'by' (satisfy/verify subject) // RelFeaturedBy models a KerML TypeFeaturing written in a feature // declaration: `featured by T` states a type the feature is a feature of // (KerML.xtext TypeFeaturingPart, 8.3.3.1.4). KerML notation only. RelFeaturedBy // 'featured by' RelDifferences // 'differences' )
func (RelationshipKind) String ¶
func (k RelationshipKind) String() string
type RelationshipMember ¶ added in v0.2.0
type RelationshipMember struct {
NodeBase
Ident Identification
Kind RelationshipKind
// Keyword is the relationship keyword as written (`subtype`, `subclassifier`),
// and PrefixKeyword the one that may precede it (`specialization`).
Keyword string
PrefixKeyword string
Source Node // the specific/subsetting/featured end
Target Node // the general/subsetted/featuring end
// Conjugated marks a Conjugation, whose target is the conjugate of Source.
Conjugated bool
Visibility Visibility
Members []Node
HasBody bool
}
RelationshipMember is a KerML relationship written keyword-first as a member of its own: `specialization Gen subtype A specializes B;` (KerML.xtext:390). Its two ends are ordered — Source relates to Target, never the reverse.
type RequireMember ¶
type RequireMember struct {
NodeBase
// Prefix metadata written before the declaration: `require #goal r;`.
Prefixes []*PrefixMetadata
Expression Node // the reference the member states, when written as one
Reference *QualifiedName // referenced requirement (reference-subsetting form, SysML v2 §7.20)
Body []Node // nested members: ConstraintMembers for the braced form, requirement members for the reference form
// Declaration of the constraint the member owns, when it is written with
// one: `require constraint <c> c1 : C;`. DeclSpan covers it from `constraint` on.
Ident Identification
DeclSpan source.Span
Relationships []*Relationship
Multiplicity *Multiplicity
Value Node
// ValueOperatorSpan covers the value operator; ValueIsDefault and
// ValueIsInitial are its `default` and `:=` (KerML FeatureValue).
ValueOperatorSpan source.Span
ValueIsDefault bool
ValueIsInitial bool
// HasBody records that the member was written with braces, which an empty
// body does not otherwise show.
HasBody bool
}
RequireMember represents a requirement constraint. Syntax: require <reference>; OR require constraint { <expression>... } OR require <Q::r> { body }
type RootNamespace ¶
type RootNamespace struct {
NodeBase
Members []Node // *Membership | *Import | *Alias | *ErrorNode
}
RootNamespace is the top of every parsed file: a flat list of members.
type SelectExpr ¶
SelectExpr is `operand .? body`.
type SendStatement ¶
type SendStatement struct {
NodeBase
Message Node // message expression (often NewExpression); nil when the send declared none
Target Node // target expression: the receiver (`to`) or the sending port (`via`)
IsVia bool // the target is a port to route through, not a receiver
// Receiver is the receiver of a send that states both clauses (`send x via p
// to r`), which SysML.xtext SenderReceiverPart allows.
Receiver Node
// Members and HasBody carry the body SysML.xtext SendNode ends in, where the
// message a send with no argument carries is declared (`send { in :>> payload
// = s; }`).
Members []Node
HasBody bool
}
SendStatement sends a message to a target. Syntax: send <message> to <target>; | send <message> via <port>;
The two forms address different things and are not interchangeable: `to` names the receiver directly, while `via` names a port of the sender, and the message reaches whatever that port is connected to. IsVia records which form was written so routing can tell them apart.
type SequenceExpr ¶
SequenceExpr is a comma-separated list of expressions (flattened).
type StateNode ¶
type StateNode struct {
NodeBase
Name string
Entry []Node // entry behaviors (action sequence)
Do []Node // do action (ongoing action)
Exit []Node // exit behaviors (action sequence)
// Defer names the events the state defers while it is active: an event no
// transition of the active configuration handles is retained instead of
// dropped, and delivered again once no active state defers it.
Defer []Node
Substates []Node // nested states (hierarchical)
Regions []*StateRegion // orthogonal regions (parallel)
}
StateNode represents a state in a state machine (simple, composite, or orthogonal).
type StateRegion ¶
StateRegion is an orthogonal region within a composite state.
type SubjectMember ¶
type SubjectMember struct {
NodeBase
// Prefixes are the metadata written after the keyword: the `#B` of
// `subject #B s` (SysML.xtext SubjectUsage UsageExtensionKeyword).
Prefixes []*PrefixMetadata
Ident Identification // `<short> name`, either or both optional (SysML.xtext Identification)
TypeRef *QualifiedName // subject type (for declaration form)
Multiplicity *Multiplicity // optional multiplicity
Relationships []*Relationship // specializations written after the type (`:>> RequirementCheck::subj`)
Body []Node // optional nested members
BindingExpr Node // value part: `subject = <expr>;` or a declaration's `= expr` / `default expr`
// ValueOperatorSpan, ValueIsDefault and ValueIsInitial describe BindingExpr's
// operator as Usage's fields of the same names do.
ValueOperatorSpan source.Span
ValueIsDefault bool
ValueIsInitial bool
// HasBody records that the declaration was written with braces, which an
// empty body does not otherwise show.
HasBody bool
}
SubjectMember represents the subject declaration in a requirement body. Syntax: subject [<short>] [name] : <Type>; OR subject = <expr>;
func (*SubjectMember) EffectiveName ¶ added in v0.5.0
func (m *SubjectMember) EffectiveName() (string, source.Span)
EffectiveName returns the name the subject answers to: its declared name, else the name its naming feature supplies.
func (*SubjectMember) NamingFeature ¶ added in v0.5.0
func (m *SubjectMember) NamingFeature() *Relationship
NamingFeature returns the relationship naming a subject declared without a name, as for a usage: `subject <s> :>> vehicle;` answers to `vehicle`.
type SubstateMember ¶
type SubstateMember struct {
NodeBase
Name string // substate name
NameSpan source.Span // span of Name, empty for an unnamed node
}
SubstateMember represents a nested state declaration. Syntax: state <name>;
type SuccessionEdge ¶
type SuccessionEdge struct {
NodeBase
Source *QualifiedName // source action node
Target *QualifiedName // target action node
// SourceMember and TargetMember are the members a member-attached `then`
// (SysML.xtext EmptySuccessionMember) sequences when the member declares no
// name a reference could use — `then send fullyCharged() to self;`, `then
// loop action { … } until c;`. The notation binds such an end by position, so
// the end is that member itself rather than a name; they are the members
// beside the keyword as written, set once when the body is parsed.
SourceMember Node
TargetMember Node
// SourceImplied and TargetImplied mark an end the notation supplied rather
// than the author writing it: the source a one-name `then <target>;` takes
// from the member before it, and the ends of the edge a member-attached
// `then` desugars to. Such a name is a member's own, not a reference written
// in the model.
SourceImplied bool
TargetImplied bool
// Members are the body an action target succession carries
// (SysML.xtext:1698 ActionTargetSuccession ends in a UsageBody), and
// HasBody that it was written with one rather than ended by ';'.
Members []Node
HasBody bool
}
SuccessionEdge is sequential control flow in actions (source then target).
type TerminateStatement ¶
type TerminateStatement struct {
NodeBase
Target Node // occurrence to terminate; nil terminates the performing occurrence
}
TerminateStatement terminates an action or lifecycle. Syntax: terminate [<target>];
type TextualRepresentation ¶
type TextualRepresentation struct {
NodeBase
Ident Identification
Language string
BodySpan source.Span
}
TextualRepresentation is `[rep <id>] language s /* ... */`.
type TimeEvent ¶
type TimeEvent struct {
NodeBase
Duration Node // time expression (literal or variable)
Absolute bool // true for `at`, false for `after`
}
TimeEvent fires at a point in time. Absolute distinguishes `accept at <time>`, which fires at the given instant, from `accept after <duration>`, which fires that far after the source state is entered.
type TransitionEdge ¶
type TransitionEdge struct {
NodeBase
Source *QualifiedName // source state
Target *QualifiedName // target state
Trigger TriggerEvent // event that fires transition (interface, see below)
Guard Node // optional guard expression
Effect []Node // optional effect actions
}
TransitionEdge is a state machine transition.
type TransitionMember ¶
type TransitionMember struct {
NodeBase
Name string // the transition's own name, empty when anonymous
NameSpan source.Span // span of Name, empty for an anonymous transition
Source *QualifiedName // source state
Target *QualifiedName // target state
Trigger Node // optional trigger event (TimeEvent/ChangeEvent/etc)
// TriggerSpan spans the accepter the trigger keyword introduces
// (`accept A`), which is the element the accepter rules are about.
TriggerSpan source.Span
Guard Node // optional guard expression
Effect []Node // optional effect actions
HasEffect bool // a `do` was written, even one whose braces hold nothing
// Via is the port the trigger's message must arrive at
// (`accept :> ping via commPort`), nil when the trigger named none.
Via *QualifiedName
// Members and HasBody carry the body a transition may declare, since both
// TransitionUsage and TargetTransitionUsage end in ActionBody
// (`then starting { … }`).
Members []Node
HasBody bool
}
TransitionMember represents a state transition in textual form, in either the standard spelling (SysML.xtext `TransitionUsage`)
transition [<name>] first <source> [accept <trigger>] [if <guard>]
[do <effect>] then <target>;
or the `transition <source> to <target> …` spelling OpenSysML also accepts.
type TriggerEvent ¶
type TriggerEvent interface {
Node
// contains filtered or unexported methods
}
TriggerEvent is the interface for state transition triggers.
type Trivia ¶
type Trivia struct {
Kind TriviaKind
Span source.Span
}
Trivia is a non-semantic token (notes/free comments) attached to a node for features like doc-comment hover and future formatting. Whitespace carries nothing a consumer reads and is not recorded.
type TriviaKind ¶
type TriviaKind int
TriviaKind classifies a trivia token attached to a node.
const ( TriviaComment TriviaKind = iota // REGULAR_COMMENT that is not a comment/doc/rep body TriviaLineNote // SL_NOTE TriviaBlockNote // ML_NOTE )
type Usage ¶
type Usage struct {
NodeBase
Prefixes []*PrefixMetadata
Kind UsageKind
// Keyword is the kind keyword as written. Several synonyms map to one Kind
// (`datatype`, `feature` and `attribute` all give UsageAttribute), so it is
// kept to tell those spellings apart.
Keyword string
// PrefixKeyword is the keyword written ahead of the kind keyword to qualify
// it rather than to name the declaration: the `assert` of
// `assert constraint c : C` (SysML.xtext AssertConstraintUsage).
PrefixKeyword string
IsAbstract bool
IsVariation bool // 'variation' modifier: the usage is a variation point
IsVariant bool // declared with 'variant': a variant of the enclosing variation
IsReference bool
IsVariable bool // 'var' feature modifier
IsAll bool // 'all' multiplicity propagation modifier
IsEnd bool // 'end' feature modifier
IsChain bool // 'chain' feature modifier
IsConstant bool // 'constant' feature modifier
IsEvent bool // 'event' modifier for event-driven occurrences
IsIndividual bool // 'individual' modifier: OccurrenceUsage::isIndividual
// Portion is the `snapshot` or `timeslice` prefix of an occurrence usage
// (OccurrenceUsage::portionKind, SysML v2 8.3.9.11).
Portion PortionKind
IsAccept bool // 'accept' action for message consumption
// IsBodyParameter marks the `action [<name>] { … }` a loop or branch body is
// written as (SysML.xtext ActionBodyParameter), not a nested action node.
IsBodyParameter bool
// IsActionNode marks an action written as one node with its statement
// (`action s send x to r;`, SysML.xtext SendNode): Members hold that statement, not a body.
IsActionNode bool
IsResult bool // declared with 'return': the result parameter of a calculation/expression
// IsNegated is the `not` of `assert not constraint { … }` and
// `assert not satisfy … by …`: the conditions are asserted to be false
// (Invariant::isNegated, SysML v2 §8.3.21.10).
IsNegated bool
// DeclaresRequirement is the `requirement` of `satisfy requirement r by v`:
// the satisfy/verify usage declares its requirement rather than referencing one.
DeclaresRequirement bool
Visibility Visibility
Direction FeatureDirection
IsComposite bool
// IsPortion is the `portion` of `portion feature p`: the feature's values
// are portions of its featuring instances (KerML Feature::isPortion).
IsPortion bool
// IsParallel is the `parallel` before a state body (StateUsage::isParallel).
IsParallel bool
IsDerived bool
IsOrdered bool
IsNonunique bool
Ident Identification
Relationships []*Relationship
Multiplicity *Multiplicity
// CrossFeature is the cross feature an end declares inline ahead of its own
// declaration (KerML.xtext OwnedCrossFeatureMember).
CrossFeature *CrossFeatureMember
Value Node
ValueOperatorSpan source.Span
// ValueIsDefault and ValueIsInitial are the `default` and `:=` of the value
// part (KerML FeatureValue::isDefault, isInitial).
ValueIsDefault bool
ValueIsInitial bool
Members []Node
HasBody bool
// Tier B connection/flow/port grammar. These are nil/zero for kinds
// that do not use them.
ConnectorEnds []*ConnectorEnd // connection / interface / allocation usage ends
FlowEnds *FlowEnds // flow usage ends
}
Usage is a `part` / `attribute` usage node (and all other usage kinds).
func (*Usage) ConjugatedTyping ¶
func (u *Usage) ConjugatedTyping() (*Relationship, bool)
ConjugatedTyping returns the usage's conjugated port typing (`: ~P`), if any.
func (*Usage) HasConjugatedTyping ¶
HasConjugatedTyping reports whether the usage declares a `: ~P` typing.
func (*Usage) IsPerformedAction ¶ added in v0.5.0
IsPerformedAction reports whether the usage is a `perform action a : A;` or a `perform a;`: an action the owner performs (SysML v2 PerformActionUsage).
func (*Usage) IsSuccessionFlow ¶ added in v0.5.0
IsSuccessionFlow reports whether the usage is a `succession flow`: a flow that also orders its ends (SysML v2 SuccessionFlowUsage).
func (*Usage) PerformedInvocation ¶ added in v0.5.0
func (u *Usage) PerformedInvocation() *InvocationExpr
PerformedInvocation is the call an action usage performs as its value (`action a = tag(x);`); nil for any other usage or value.
type UsageKind ¶
type UsageKind int
UsageKind discriminates the concrete usage taxonomy element.
const ( UsagePart UsageKind = iota UsageAttribute // Tier A. UsageItem UsageOccurrence UsageIndividual UsageMetadata UsageEnumeration UsageView UsageViewpoint UsageRendering // UsageViewRendering is the rendering a view body names with `render` // (SysML.xtext ViewRenderingMember/ViewRenderingUsage, SysML v2 §8.3.26): a // RenderingUsage owned by a ViewRenderingMembership, which either references // an existing rendering (`render asTreeDiagram;`) or declares one // (`render rendering r : AsTree;`). UsageViewRendering UsageConcern // UsageFramedConcern is the concern a requirement, concern or viewpoint body // frames with `frame` (SysML.xtext FramedConcernMember/FramedConcernUsage, // SysML v2 §8.3.20): a ConcernUsage owned by a FramedConcernMembership, // either referencing an existing concern (`frame 'system breakdown';`) or // declaring one (`frame concern c : SafetyConcern;`). UsageFramedConcern // Tier B. UsageConnection UsageConnector UsageSuccession UsageFlow UsagePort UsageInterface UsageInteraction UsageAllocation UsageBinding // Tier C. UsageAction UsageState UsageTransition UsageStep UsageCalc UsageExpr UsageConstraint UsageRequirement UsageSatisfy // satisfy requirement ... by ... UsageSubject // UsageActor is an actor of a requirement, use case or viewpoint // (SysML.xtext ActorMember/ActorUsage, SysML v2 §8.3.19): a PartUsage owned // by an ActorMembership. The notation declares it; it has no reference form. UsageActor // UsageStakeholder is a stakeholder of a requirement, concern or viewpoint // (SysML.xtext StakeholderMember/StakeholderUsage, SysML v2 §8.3.19): a // PartUsage owned by a StakeholderMembership, declared like an actor. UsageStakeholder UsageObjective UsageCase UsageAnalysisCase UsageVerificationCase UsageUseCase // KerML structural kinds UsageBehavior UsageAssoc UsageStruct UsageClass UsagePredicate UsageBool )
type Visibility ¶
type Visibility int
Visibility mirrors SysML VisibilityKind.
const ( VisibilityDefault Visibility = iota // no explicit indicator VisibilityPublic VisibilityPrivate VisibilityProtected )
type WhileLoopActionNode ¶
type WhileLoopActionNode struct {
NodeBase
Kind LoopKind
Condition Node // boolean expression; nil for `for` and for `loop` without `until`
Body []Node // statements in loop body
// Until is the condition an `until` clause of a `while` loop tests after each
// iteration (`while c { … } until d;`), nil otherwise. A `loop` form records
// its own `until` condition in Condition.
Until Node
// Variable is the iteration variable a `for` loop declares. It is a member of
// the loop's own body scope, never of the enclosing behavior. Zero for the
// other loop forms.
Variable Identification
// VariableRelationships are the specializations the iteration variable was
// declared with (`for n : ScalarValues::Integer in …`), empty when it stated
// none: SysML.xtext ForVariableDeclaration is a full UsageDeclaration.
VariableRelationships []*Relationship
// Collection is the expression a `for` loop iterates over, nil otherwise.
Collection Node
}
WhileLoopActionNode represents a loop in an action body, in any of the three forms LoopKind names: `while c { … }`, `loop { … } until c;`, `for x in c { … }`.