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 name: String,
57 pub type_name: Option<String>,
58 pub name_span: Span,
59 pub type_span: Option<Span>,
60}
61
62#[derive(Debug, Clone, PartialEq, Eq)]
64pub struct PurposeMember {
65 pub target: String,
66 pub target_span: Span,
67}
68
69#[derive(Debug, Clone, PartialEq, Eq)]
71pub struct SubjectDecl {
72 pub name: String,
73 pub type_name: String,
74}
75
76#[derive(Debug, Clone, PartialEq, Eq)]
78pub struct RequirementActorDecl {
79 pub name: String,
80 pub type_name: String,
81}
82
83#[derive(Debug, Clone, PartialEq, Eq)]
85pub struct RequireConstraint {
86 pub body: RequireConstraintBody,
87}
88
89#[derive(Debug, Clone, PartialEq, Eq)]
92pub struct VerifyRequirementMember {
93 pub explicit_requirement_keyword: bool,
95 pub requirement: Option<Node<RequirementUsage>>,
97 pub target: Option<String>,
99}
100
101#[derive(Debug, Clone, PartialEq, Eq)]
103pub enum RequireConstraintBody {
104 Semicolon,
105 Brace {
106 elements: Vec<Node<ConstraintDefBodyElement>>,
107 },
108}
109
110#[derive(Debug, Clone, PartialEq, Eq)]
112pub struct Satisfy {
113 pub source: Node<Expression>,
114 pub target: Node<Expression>,
115 pub body: ConnectBody,
116}
117
118#[derive(Debug, Clone, PartialEq, Eq)]
120pub struct RequirementUsage {
121 pub name: String,
122 pub type_name: Option<String>,
123 pub subsets: Option<String>,
124 pub body: RequirementDefBody,
125}
126
127#[derive(Debug, Clone, PartialEq, Eq)]
129pub struct ItemUsage {
130 pub name: String,
131 pub type_name: Option<String>,
132 pub multiplicity: Option<String>,
133 pub body: AttributeBody,
134 pub direction: Option<InOut>,
136}
137
138#[derive(Debug, Clone, PartialEq, Eq)]
140pub struct EnumerationUsage {
141 pub name: String,
142 pub type_name: Option<String>,
143 pub multiplicity: Option<String>,
144 pub body: AttributeBody,
145}
146
147#[derive(Debug, Clone, PartialEq, Eq)]
149pub struct Dependency {
150 pub identification: Option<Identification>,
151 pub clients: Vec<String>,
152 pub suppliers: Vec<String>,
153 pub body: ConnectBody,
154}
155
156#[derive(Debug, Clone, PartialEq, Eq)]
158pub struct FrameMember {
159 pub name: String,
160 pub body: RequirementDefBody,
161}
162
163#[derive(Debug, Clone, PartialEq, Eq)]
165pub struct ConcernUsage {
166 pub name: String,
167 pub type_name: Option<String>,
168 pub body: RequirementDefBody,
169}
170
171#[derive(Debug, Clone, PartialEq, Eq)]
173pub struct CaseDef {
174 pub identification: Identification,
175 pub specializes: Option<String>,
176 pub specializes_span: Option<Span>,
177 pub body: UseCaseDefBody,
178}
179
180#[derive(Debug, Clone, PartialEq, Eq)]
182pub struct CaseUsage {
183 pub name: String,
184 pub type_name: Option<String>,
185 pub body: UseCaseDefBody,
186}
187
188#[derive(Debug, Clone, PartialEq, Eq)]
190pub struct AnalysisCaseDef {
191 pub identification: Identification,
192 pub specializes: Option<String>,
193 pub specializes_span: Option<Span>,
194 pub body: UseCaseDefBody,
195}
196
197#[derive(Debug, Clone, PartialEq, Eq)]
199pub struct AnalysisCaseUsage {
200 pub name: String,
201 pub type_name: Option<String>,
202 pub body: UseCaseDefBody,
203}
204
205#[derive(Debug, Clone, PartialEq, Eq)]
207pub struct VerificationCaseDef {
208 pub identification: Identification,
209 pub specializes: Option<String>,
210 pub specializes_span: Option<Span>,
211 pub body: UseCaseDefBody,
212}
213
214#[derive(Debug, Clone, PartialEq, Eq)]
216pub struct VerificationCaseUsage {
217 pub name: String,
218 pub type_name: Option<String>,
219 pub body: UseCaseDefBody,
220}
221
222#[derive(Debug, Clone, PartialEq, Eq)]
224pub struct UseCaseUsage {
225 pub name: String,
226 pub type_name: Option<String>,
227 pub body: UseCaseDefBody,
228}
229
230#[derive(Debug, Clone, PartialEq, Eq)]
236pub struct ActorDecl {
237 pub identification: Identification,
238}
239
240#[derive(Debug, Clone, PartialEq, Eq)]
242pub struct UseCaseDef {
243 pub identification: Identification,
244 pub specializes: Option<String>,
245 pub specializes_span: Option<Span>,
246 pub body: UseCaseDefBody,
247}
248
249#[derive(Debug, Clone, PartialEq, Eq)]
250pub enum UseCaseDefBody {
251 Semicolon,
252 Brace {
253 elements: Vec<Node<UseCaseDefBodyElement>>,
254 },
255}
256
257#[derive(Debug, Clone, PartialEq, Eq)]
259pub struct FirstSuccession {
260 pub target: String,
261}
262
263#[derive(Debug, Clone, PartialEq, Eq)]
265pub struct ThenDone {}
266
267#[derive(Debug, Clone, PartialEq, Eq)]
269pub struct IncludeUseCase {
270 pub name: String,
271 pub multiplicity: Option<String>,
273 pub body: UseCaseDefBody,
274}
275
276#[derive(Debug, Clone, PartialEq, Eq)]
278pub struct ThenIncludeUseCase {
279 pub include: Node<IncludeUseCase>,
280}
281
282#[derive(Debug, Clone, PartialEq, Eq)]
284pub struct ThenUseCaseUsage {
285 pub use_case: Node<UseCaseUsage>,
286}
287
288#[derive(Debug, Clone, PartialEq, Eq)]
290pub struct SubjectRef {}
291
292#[derive(Debug, Clone, PartialEq, Eq)]
294pub struct ActorRedefinitionAssignment {
295 pub name: String,
296 pub rhs: String,
298}
299
300#[derive(Debug, Clone, PartialEq, Eq)]
302pub struct RefRedefinition {
303 pub name: String,
304 pub body: String,
306}
307
308#[derive(Debug, Clone, PartialEq, Eq)]
310pub struct ReturnRef {
311 pub name: String,
312 pub multiplicity: Option<String>,
313 pub body: String,
315}
316
317#[derive(Debug, Clone, PartialEq, Eq)]
318pub enum UseCaseDefBodyElement {
319 Error(Node<ParseErrorNode>),
320 Other(String),
322 Annotation(Node<Annotation>),
323 MetadataKeywordUsage(Node<MetadataKeywordUsage>),
324 AttributeDef(Node<AttributeDef>),
325 Doc(Node<DocComment>),
326 SubjectDecl(Node<SubjectDecl>),
327 SubjectRef(Node<SubjectRef>),
329 ActorUsage(Node<ActorUsage>),
330 ActorRedefinitionAssignment(Node<ActorRedefinitionAssignment>),
331 Objective(Node<Objective>),
332 FirstSuccession(Node<FirstSuccession>),
333 ThenIncludeUseCase(Node<ThenIncludeUseCase>),
334 ThenUseCaseUsage(Node<ThenUseCaseUsage>),
335 ThenDone(Node<ThenDone>),
336 IncludeUseCase(Node<IncludeUseCase>),
337 RefRedefinition(Node<RefRedefinition>),
338 ReturnRef(Node<ReturnRef>),
339 Assign(Node<AssignStmt>),
340 ForLoop(Node<ForLoop>),
341 ThenAction(Node<ThenAction>),
342}
343
344#[derive(Debug, Clone, PartialEq, Eq)]
346pub struct ActorUsage {
347 pub name: String,
348 pub type_name: String,
349}
350
351#[derive(Debug, Clone, PartialEq, Eq)]
353pub struct Objective {
354 pub visibility: Option<Visibility>,
355 pub requirement: Node<RequirementUsage>,
356}
357
358