1use super::behavior::{AssignStmt, ForLoop, InOut, 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 pub direction: Option<InOut>,
134}
135
136#[derive(Debug, Clone, PartialEq, Eq)]
138pub struct EnumerationUsage {
139 pub name: String,
140 pub type_name: Option<String>,
141 pub multiplicity: Option<String>,
142 pub body: AttributeBody,
143}
144
145#[derive(Debug, Clone, PartialEq, Eq)]
147pub struct Dependency {
148 pub identification: Option<Identification>,
149 pub clients: Vec<String>,
150 pub suppliers: Vec<String>,
151 pub body: ConnectBody,
152}
153
154#[derive(Debug, Clone, PartialEq, Eq)]
156pub struct FrameMember {
157 pub name: String,
158 pub body: RequirementDefBody,
159}
160
161#[derive(Debug, Clone, PartialEq, Eq)]
163pub struct ConcernUsage {
164 pub name: String,
165 pub type_name: Option<String>,
166 pub body: RequirementDefBody,
167}
168
169#[derive(Debug, Clone, PartialEq, Eq)]
171pub struct CaseDef {
172 pub identification: Identification,
173 pub specializes: Option<String>,
174 pub specializes_span: Option<Span>,
175 pub body: UseCaseDefBody,
176}
177
178#[derive(Debug, Clone, PartialEq, Eq)]
180pub struct CaseUsage {
181 pub name: String,
182 pub type_name: Option<String>,
183 pub body: UseCaseDefBody,
184}
185
186#[derive(Debug, Clone, PartialEq, Eq)]
188pub struct AnalysisCaseDef {
189 pub identification: Identification,
190 pub specializes: Option<String>,
191 pub specializes_span: Option<Span>,
192 pub body: UseCaseDefBody,
193}
194
195#[derive(Debug, Clone, PartialEq, Eq)]
197pub struct AnalysisCaseUsage {
198 pub name: String,
199 pub type_name: Option<String>,
200 pub body: UseCaseDefBody,
201}
202
203#[derive(Debug, Clone, PartialEq, Eq)]
205pub struct VerificationCaseDef {
206 pub identification: Identification,
207 pub specializes: Option<String>,
208 pub specializes_span: Option<Span>,
209 pub body: UseCaseDefBody,
210}
211
212#[derive(Debug, Clone, PartialEq, Eq)]
214pub struct VerificationCaseUsage {
215 pub name: String,
216 pub type_name: Option<String>,
217 pub body: UseCaseDefBody,
218}
219
220#[derive(Debug, Clone, PartialEq, Eq)]
222pub struct UseCaseUsage {
223 pub name: String,
224 pub type_name: Option<String>,
225 pub body: UseCaseDefBody,
226}
227
228#[derive(Debug, Clone, PartialEq, Eq)]
234pub struct ActorDecl {
235 pub identification: Identification,
236}
237
238#[derive(Debug, Clone, PartialEq, Eq)]
240pub struct UseCaseDef {
241 pub identification: Identification,
242 pub specializes: Option<String>,
243 pub specializes_span: Option<Span>,
244 pub body: UseCaseDefBody,
245}
246
247#[derive(Debug, Clone, PartialEq, Eq)]
248pub enum UseCaseDefBody {
249 Semicolon,
250 Brace {
251 elements: Vec<Node<UseCaseDefBodyElement>>,
252 },
253}
254
255#[derive(Debug, Clone, PartialEq, Eq)]
257pub struct FirstSuccession {
258 pub target: String,
259}
260
261#[derive(Debug, Clone, PartialEq, Eq)]
263pub struct ThenDone {}
264
265#[derive(Debug, Clone, PartialEq, Eq)]
267pub struct IncludeUseCase {
268 pub name: String,
269 pub multiplicity: Option<String>,
271 pub body: UseCaseDefBody,
272}
273
274#[derive(Debug, Clone, PartialEq, Eq)]
276pub struct ThenIncludeUseCase {
277 pub include: Node<IncludeUseCase>,
278}
279
280#[derive(Debug, Clone, PartialEq, Eq)]
282pub struct ThenUseCaseUsage {
283 pub use_case: Node<UseCaseUsage>,
284}
285
286#[derive(Debug, Clone, PartialEq, Eq)]
288pub struct SubjectRef {}
289
290#[derive(Debug, Clone, PartialEq, Eq)]
292pub struct ActorRedefinitionAssignment {
293 pub name: String,
294 pub rhs: String,
296}
297
298#[derive(Debug, Clone, PartialEq, Eq)]
300pub struct RefRedefinition {
301 pub name: String,
302 pub body: String,
304}
305
306#[derive(Debug, Clone, PartialEq, Eq)]
308pub struct ReturnRef {
309 pub name: String,
310 pub multiplicity: Option<String>,
311 pub body: String,
313}
314
315#[derive(Debug, Clone, PartialEq, Eq)]
316pub enum UseCaseDefBodyElement {
317 Error(Node<ParseErrorNode>),
318 Other(String),
320 Annotation(Node<Annotation>),
321 MetadataKeywordUsage(Node<MetadataKeywordUsage>),
322 AttributeDef(Node<AttributeDef>),
323 Doc(Node<DocComment>),
324 SubjectDecl(Node<SubjectDecl>),
325 SubjectRef(Node<SubjectRef>),
327 ActorUsage(Node<ActorUsage>),
328 ActorRedefinitionAssignment(Node<ActorRedefinitionAssignment>),
329 Objective(Node<Objective>),
330 FirstSuccession(Node<FirstSuccession>),
331 ThenIncludeUseCase(Node<ThenIncludeUseCase>),
332 ThenUseCaseUsage(Node<ThenUseCaseUsage>),
333 ThenDone(Node<ThenDone>),
334 IncludeUseCase(Node<IncludeUseCase>),
335 RefRedefinition(Node<RefRedefinition>),
336 ReturnRef(Node<ReturnRef>),
337 Assign(Node<AssignStmt>),
338 ForLoop(Node<ForLoop>),
339 ThenAction(Node<ThenAction>),
340}
341
342#[derive(Debug, Clone, PartialEq, Eq)]
344pub struct ActorUsage {
345 pub name: String,
346 pub type_name: String,
347}
348
349#[derive(Debug, Clone, PartialEq, Eq)]
351pub struct Objective {
352 pub visibility: Option<Visibility>,
353 pub requirement: Node<RequirementUsage>,
354}
355
356