1#[derive(Debug, Clone, PartialEq, Eq)]
3pub struct AdaRoot {
4 pub items: Vec<AdaItem>,
6}
7
8impl AdaRoot {
9 pub fn new(items: Vec<AdaItem>) -> Self {
11 Self { items }
12 }
13
14 pub fn items(&self) -> &[AdaItem] {
16 &self.items
17 }
18}
19
20#[derive(Debug, Clone, PartialEq, Eq)]
22pub enum AdaItem {
23 Package(AdaPackage),
24 Procedure(AdaProcedure),
25 Function(AdaFunction),
26 Type(AdaTypeDeclaration),
27 Variable(AdaVariableDeclaration),
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct AdaPackage {
33 pub name: String,
34}
35
36impl AdaPackage {
37 pub fn new(name: String) -> Self {
38 Self { name }
39 }
40}
41
42#[derive(Debug, Clone, PartialEq, Eq)]
44pub struct AdaProcedure {
45 pub name: String,
46 pub parameters: Vec<AdaParameter>,
47}
48
49impl AdaProcedure {
50 pub fn new(name: String, parameters: Vec<AdaParameter>) -> Self {
51 Self { name, parameters }
52 }
53}
54
55#[derive(Debug, Clone, PartialEq, Eq)]
57pub struct AdaFunction {
58 pub name: String,
59 pub parameters: Vec<AdaParameter>,
60 pub return_type: String,
61}
62
63impl AdaFunction {
64 pub fn new(name: String, parameters: Vec<AdaParameter>, return_type: String) -> Self {
65 Self { name, parameters, return_type }
66 }
67}
68
69#[derive(Debug, Clone, PartialEq, Eq)]
71pub struct AdaParameter {
72 pub name: String,
73 pub param_type: String,
74}
75
76impl AdaParameter {
77 pub fn new(name: String, param_type: String) -> Self {
78 Self { name, param_type }
79 }
80}
81
82#[derive(Debug, Clone, PartialEq, Eq)]
84pub struct AdaTypeDeclaration {
85 pub name: String,
86 pub type_def: String,
87}
88
89impl AdaTypeDeclaration {
90 pub fn new(name: String, type_def: String) -> Self {
91 Self { name, type_def }
92 }
93}
94
95#[derive(Debug, Clone, PartialEq, Eq)]
97pub struct AdaVariableDeclaration {
98 pub name: String,
99 pub var_type: String,
100}
101
102impl AdaVariableDeclaration {
103 pub fn new(name: String, var_type: String) -> Self {
104 Self { name, var_type }
105 }
106}
107
108impl Default for AdaRoot {
109 fn default() -> Self {
110 Self::new(Vec::new())
111 }
112}