1use super::behavior::InOutDecl;
2use super::common::FilterMember;
3use super::common::{ConnectBody, DocComment, Identification, ParseErrorNode};
4use super::requirement::RequirementDefBody;
5use crate::ast::core::{Expression, Node, Span};
6
7#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct ConstraintDef {
10 pub identification: Identification,
11 pub specializes: Option<String>,
12 pub specializes_span: Option<Span>,
13 pub body: ConstraintDefBody,
14}
15
16#[derive(Debug, Clone, PartialEq, Eq)]
17pub enum ConstraintDefBody {
18 Semicolon,
19 Brace {
20 elements: Vec<Node<ConstraintDefBodyElement>>,
21 },
22}
23
24#[derive(Debug, Clone, PartialEq, Eq)]
25pub enum ConstraintDefBodyElement {
26 Error(Node<ParseErrorNode>),
27 Doc(Node<DocComment>),
28 InOutDecl(Node<InOutDecl>),
29 Expression(Node<Expression>), Other(String),
32}
33
34#[derive(Debug, Clone, PartialEq, Eq)]
36pub enum ConstraintBody {
37 Semicolon,
38 Brace, }
40
41#[derive(Debug, Clone, PartialEq, Eq)]
43pub struct CalcDef {
44 pub identification: Identification,
45 pub body: CalcDefBody,
46}
47
48#[derive(Debug, Clone, PartialEq, Eq)]
50pub struct CalcUsage {
51 pub identification: Identification,
52 pub type_name: Option<String>,
53 pub body: CalcDefBody,
54}
55
56#[derive(Debug, Clone, PartialEq, Eq)]
57pub enum CalcDefBody {
58 Semicolon,
59 Brace {
60 elements: Vec<Node<CalcDefBodyElement>>,
61 },
62}
63
64#[derive(Debug, Clone, PartialEq, Eq)]
65pub enum CalcDefBodyElement {
66 Error(Node<ParseErrorNode>),
67 Doc(Node<DocComment>),
68 InOutDecl(Node<InOutDecl>),
69 ReturnDecl(Node<ReturnDecl>),
70 Expression(Node<Expression>), Other(String),
73}
74
75#[derive(Debug, Clone, PartialEq, Eq)]
77pub struct ReturnDecl {
78 pub name: String,
79 pub type_name: String,
80}
81
82#[derive(Debug, Clone, PartialEq, Eq)]
88pub struct ViewDef {
89 pub identification: Identification,
90 pub specializes: Option<String>,
91 pub specializes_span: Option<Span>,
92 pub body: ViewDefBody,
93}
94
95#[derive(Debug, Clone, PartialEq, Eq)]
96pub enum ViewDefBody {
97 Semicolon,
98 Brace {
99 elements: Vec<Node<ViewDefBodyElement>>,
100 },
101}
102
103#[derive(Debug, Clone, PartialEq, Eq)]
104pub enum ViewDefBodyElement {
105 Error(Node<ParseErrorNode>),
106 Other(String),
108 Doc(Node<DocComment>),
109 Filter(Node<FilterMember>),
110 ViewRendering(Node<ViewRenderingUsage>),
111}
112
113#[derive(Debug, Clone, PartialEq, Eq)]
115pub struct ViewRenderingUsage {
116 pub name: String,
117 pub type_name: Option<String>,
118 pub body: ConnectBody,
119}
120
121#[derive(Debug, Clone, PartialEq, Eq)]
123pub struct ViewpointDef {
124 pub identification: Identification,
125 pub specializes: Option<String>,
126 pub specializes_span: Option<Span>,
127 pub body: RequirementDefBody,
128}
129
130#[derive(Debug, Clone, PartialEq, Eq)]
132pub struct RenderingDef {
133 pub identification: Identification,
134 pub specializes: Option<String>,
135 pub specializes_span: Option<Span>,
136 pub body: RenderingDefBody,
137}
138
139#[derive(Debug, Clone, PartialEq, Eq)]
140pub enum RenderingDefBody {
141 Semicolon,
142 Brace {
143 elements: Vec<Node<RenderingDefBodyElement>>,
144 },
145}
146
147#[derive(Debug, Clone, PartialEq, Eq)]
148pub enum RenderingDefBodyElement {
149 Error(Node<ParseErrorNode>),
150 Doc(Node<DocComment>),
151 Filter(Node<FilterMember>),
152 ViewRendering(Node<ViewRenderingUsage>),
153 Other(String),
154}
155
156#[derive(Debug, Clone, PartialEq, Eq)]
158pub struct ViewUsage {
159 pub name: String,
160 pub type_name: Option<String>,
161 pub body: ViewBody,
162}
163
164#[derive(Debug, Clone, PartialEq, Eq)]
165pub enum ViewBody {
166 Semicolon,
167 Brace {
168 elements: Vec<Node<ViewBodyElement>>,
169 },
170}
171
172#[derive(Debug, Clone, PartialEq, Eq)]
173pub enum ViewBodyElement {
174 Error(Node<ParseErrorNode>),
175 Other(String),
177 Doc(Node<DocComment>),
178 Filter(Node<FilterMember>),
179 ViewRendering(Node<ViewRenderingUsage>),
180 Expose(Node<ExposeMember>),
181 Satisfy(Node<SatisfyViewMember>),
182}
183
184#[derive(Debug, Clone, PartialEq, Eq)]
186pub struct ExposeMember {
187 pub target: String,
189 pub body: ConnectBody,
190}
191
192#[derive(Debug, Clone, PartialEq, Eq)]
194pub struct SatisfyViewMember {
195 pub viewpoint_ref: String,
196 pub body: ConnectBody,
197}
198
199#[derive(Debug, Clone, PartialEq, Eq)]
201pub struct ViewpointUsage {
202 pub name: String,
203 pub type_name: String,
204 pub body: RequirementDefBody,
205}
206
207#[derive(Debug, Clone, PartialEq, Eq)]
209pub struct RenderingUsage {
210 pub name: String,
211 pub type_name: Option<String>,
212 pub body: ConnectBody,
213}