1use super::behavior::{AssignStmt, ForLoop, ThenAction};
2use super::common::{ConnectBody, DocComment, Identification, Import, ParseErrorNode, Visibility};
3use super::common::TextualRepresentation;
4use super::structure::{
5 Annotation, AttributeBody, AttributeDef, AttributeUsage, MetadataAnnotation,
6 MetadataKeywordUsage,
7};
8use super::view::ConstraintDefBodyElement;
9use crate::ast::core::{Expression, Node, Span};
10
11#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct RequirementDef {
14 pub identification: Identification,
15 pub specializes: Option<String>,
17 pub specializes_span: Option<Span>,
19 pub body: RequirementDefBody,
20}
21
22#[derive(Debug, Clone, PartialEq, Eq)]
24pub enum RequirementDefBody {
25 Semicolon,
26 Brace {
27 elements: Vec<Node<RequirementDefBodyElement>>,
28 },
29}
30
31#[derive(Debug, Clone, PartialEq, Eq)]
32pub enum RequirementDefBodyElement {
33 Error(Node<ParseErrorNode>),
34 Other(String),
36 Annotation(Node<Annotation>),
37 MetadataAnnotation(Node<MetadataAnnotation>),
38 MetadataKeywordUsage(Node<MetadataKeywordUsage>),
39 Import(Node<Import>),
40 SubjectDecl(Node<SubjectDecl>),
41 RequirementActorDecl(Node<RequirementActorDecl>),
42 Stakeholder(Node<StakeholderMember>),
43 Purpose(Node<PurposeMember>),
44 AttributeDef(Node<AttributeDef>),
45 AttributeUsage(Node<AttributeUsage>),
46 VerifyRequirement(Node<VerifyRequirementMember>),
47 RequireConstraint(Node<RequireConstraint>),
48 Frame(Node<FrameMember>),
49 TextualRep(Node<TextualRepresentation>),
50 Doc(Node<DocComment>),
51}
52
53#[derive(Debug, Clone, PartialEq, Eq)]
55pub struct StakeholderMember {
56 pub target: String,
57 pub target_span: Span,
58}
59
60#[derive(Debug, Clone, PartialEq, Eq)]
62pub struct PurposeMember {
63 pub target: String,
64 pub target_span: Span,
65}
66
67#[derive(Debug, Clone, PartialEq, Eq)]
69pub struct SubjectDecl {
70 pub name: String,
71 pub type_name: String,
72}
73
74#[derive(Debug, Clone, PartialEq, Eq)]
76pub struct RequirementActorDecl {
77 pub name: String,
78 pub type_name: String,
79}
80
81#[derive(Debug, Clone, PartialEq, Eq)]
83pub struct RequireConstraint {
84 pub body: RequireConstraintBody,
85}
86
87#[derive(Debug, Clone, PartialEq, Eq)]
90pub struct VerifyRequirementMember {
91 pub explicit_requirement_keyword: bool,
93 pub requirement: Option<Node<RequirementUsage>>,
95 pub target: Option<String>,
97}
98
99#[derive(Debug, Clone, PartialEq, Eq)]
101pub enum RequireConstraintBody {
102 Semicolon,
103 Brace {
104 elements: Vec<Node<ConstraintDefBodyElement>>,
105 },
106}
107
108#[derive(Debug, Clone, PartialEq, Eq)]
110pub struct Satisfy {
111 pub source: Node<Expression>,
112 pub target: Node<Expression>,
113 pub body: ConnectBody,
114}
115
116#[derive(Debug, Clone, PartialEq, Eq)]
118pub struct RequirementUsage {
119 pub name: String,
120 pub type_name: Option<String>,
121 pub subsets: Option<String>,
122 pub body: RequirementDefBody,
123}
124
125#[derive(Debug, Clone, PartialEq, Eq)]
127pub struct ItemUsage {
128 pub name: String,
129 pub type_name: Option<String>,
130 pub multiplicity: Option<String>,
131 pub body: AttributeBody,
132}
133
134#[derive(Debug, Clone, PartialEq, Eq)]
136pub struct EnumerationUsage {
137 pub name: String,
138 pub type_name: Option<String>,
139 pub multiplicity: Option<String>,
140 pub body: AttributeBody,
141}
142
143#[derive(Debug, Clone, PartialEq, Eq)]
145pub struct Dependency {
146 pub identification: Option<Identification>,
147 pub clients: Vec<String>,
148 pub suppliers: Vec<String>,
149 pub body: ConnectBody,
150}
151
152#[derive(Debug, Clone, PartialEq, Eq)]
154pub struct FrameMember {
155 pub name: String,
156 pub body: RequirementDefBody,
157}
158
159#[derive(Debug, Clone, PartialEq, Eq)]
161pub struct ConcernUsage {
162 pub name: String,
163 pub type_name: Option<String>,
164 pub body: RequirementDefBody,
165}
166
167#[derive(Debug, Clone, PartialEq, Eq)]
169pub struct CaseDef {
170 pub identification: Identification,
171 pub specializes: Option<String>,
172 pub specializes_span: Option<Span>,
173 pub body: UseCaseDefBody,
174}
175
176#[derive(Debug, Clone, PartialEq, Eq)]
178pub struct CaseUsage {
179 pub name: String,
180 pub type_name: Option<String>,
181 pub body: UseCaseDefBody,
182}
183
184#[derive(Debug, Clone, PartialEq, Eq)]
186pub struct AnalysisCaseDef {
187 pub identification: Identification,
188 pub specializes: Option<String>,
189 pub specializes_span: Option<Span>,
190 pub body: UseCaseDefBody,
191}
192
193#[derive(Debug, Clone, PartialEq, Eq)]
195pub struct AnalysisCaseUsage {
196 pub name: String,
197 pub type_name: Option<String>,
198 pub body: UseCaseDefBody,
199}
200
201#[derive(Debug, Clone, PartialEq, Eq)]
203pub struct VerificationCaseDef {
204 pub identification: Identification,
205 pub specializes: Option<String>,
206 pub specializes_span: Option<Span>,
207 pub body: UseCaseDefBody,
208}
209
210#[derive(Debug, Clone, PartialEq, Eq)]
212pub struct VerificationCaseUsage {
213 pub name: String,
214 pub type_name: Option<String>,
215 pub body: UseCaseDefBody,
216}
217
218#[derive(Debug, Clone, PartialEq, Eq)]
220pub struct UseCaseUsage {
221 pub name: String,
222 pub type_name: Option<String>,
223 pub body: UseCaseDefBody,
224}
225
226#[derive(Debug, Clone, PartialEq, Eq)]
232pub struct ActorDecl {
233 pub identification: Identification,
234}
235
236#[derive(Debug, Clone, PartialEq, Eq)]
238pub struct UseCaseDef {
239 pub identification: Identification,
240 pub specializes: Option<String>,
241 pub specializes_span: Option<Span>,
242 pub body: UseCaseDefBody,
243}
244
245#[derive(Debug, Clone, PartialEq, Eq)]
246pub enum UseCaseDefBody {
247 Semicolon,
248 Brace {
249 elements: Vec<Node<UseCaseDefBodyElement>>,
250 },
251}
252
253#[derive(Debug, Clone, PartialEq, Eq)]
255pub struct FirstSuccession {
256 pub target: String,
257}
258
259#[derive(Debug, Clone, PartialEq, Eq)]
261pub struct ThenDone {}
262
263#[derive(Debug, Clone, PartialEq, Eq)]
265pub struct IncludeUseCase {
266 pub name: String,
267 pub multiplicity: Option<String>,
269 pub body: UseCaseDefBody,
270}
271
272#[derive(Debug, Clone, PartialEq, Eq)]
274pub struct ThenIncludeUseCase {
275 pub include: Node<IncludeUseCase>,
276}
277
278#[derive(Debug, Clone, PartialEq, Eq)]
280pub struct ThenUseCaseUsage {
281 pub use_case: Node<UseCaseUsage>,
282}
283
284#[derive(Debug, Clone, PartialEq, Eq)]
286pub struct SubjectRef {}
287
288#[derive(Debug, Clone, PartialEq, Eq)]
290pub struct ActorRedefinitionAssignment {
291 pub name: String,
292 pub rhs: String,
294}
295
296#[derive(Debug, Clone, PartialEq, Eq)]
298pub struct RefRedefinition {
299 pub name: String,
300 pub body: String,
302}
303
304#[derive(Debug, Clone, PartialEq, Eq)]
306pub struct ReturnRef {
307 pub name: String,
308 pub multiplicity: Option<String>,
309 pub body: String,
311}
312
313#[derive(Debug, Clone, PartialEq, Eq)]
314pub enum UseCaseDefBodyElement {
315 Error(Node<ParseErrorNode>),
316 Other(String),
318 Annotation(Node<Annotation>),
319 MetadataKeywordUsage(Node<MetadataKeywordUsage>),
320 AttributeDef(Node<AttributeDef>),
321 Doc(Node<DocComment>),
322 SubjectDecl(Node<SubjectDecl>),
323 SubjectRef(Node<SubjectRef>),
325 ActorUsage(Node<ActorUsage>),
326 ActorRedefinitionAssignment(Node<ActorRedefinitionAssignment>),
327 Objective(Node<Objective>),
328 FirstSuccession(Node<FirstSuccession>),
329 ThenIncludeUseCase(Node<ThenIncludeUseCase>),
330 ThenUseCaseUsage(Node<ThenUseCaseUsage>),
331 ThenDone(Node<ThenDone>),
332 IncludeUseCase(Node<IncludeUseCase>),
333 RefRedefinition(Node<RefRedefinition>),
334 ReturnRef(Node<ReturnRef>),
335 Assign(Node<AssignStmt>),
336 ForLoop(Node<ForLoop>),
337 ThenAction(Node<ThenAction>),
338}
339
340#[derive(Debug, Clone, PartialEq, Eq)]
342pub struct ActorUsage {
343 pub name: String,
344 pub type_name: String,
345}
346
347#[derive(Debug, Clone, PartialEq, Eq)]
349pub struct Objective {
350 pub visibility: Option<Visibility>,
351 pub requirement: Node<RequirementUsage>,
352}
353
354