1#![doc = include_str!("readme.md")]
2#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct AdaRoot {
5 pub items: Vec<AdaItem>,
7}
8
9impl AdaRoot {
10 pub fn new(items: Vec<AdaItem>) -> Self {
12 Self { items }
13 }
14
15 pub fn items(&self) -> &[AdaItem] {
17 &self.items
18 }
19}
20
21#[derive(Debug, Clone, PartialEq, Eq)]
23pub enum AdaItem {
24 Package(AdaPackage),
26 Procedure(AdaProcedure),
28 Function(AdaFunction),
30 Type(AdaTypeDeclaration),
32 Variable(AdaVariableDeclaration),
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
38pub struct AdaPackage {
39 pub name: String,
41}
42
43impl AdaPackage {
44 pub fn new(name: String) -> Self {
46 Self { name }
47 }
48}
49
50#[derive(Debug, Clone, PartialEq, Eq)]
52pub struct AdaProcedure {
53 pub name: String,
55 pub parameters: Vec<AdaParameter>,
57}
58
59impl AdaProcedure {
60 pub fn new(name: String, parameters: Vec<AdaParameter>) -> Self {
62 Self { name, parameters }
63 }
64}
65
66#[derive(Debug, Clone, PartialEq, Eq)]
68pub struct AdaFunction {
69 pub name: String,
71 pub parameters: Vec<AdaParameter>,
73 pub return_type: String,
75}
76
77impl AdaFunction {
78 pub fn new(name: String, parameters: Vec<AdaParameter>, return_type: String) -> Self {
80 Self { name, parameters, return_type }
81 }
82}
83
84#[derive(Debug, Clone, PartialEq, Eq)]
86pub struct AdaParameter {
87 pub name: String,
89 pub param_type: String,
91}
92
93impl AdaParameter {
94 pub fn new(name: String, param_type: String) -> Self {
96 Self { name, param_type }
97 }
98}
99
100#[derive(Debug, Clone, PartialEq, Eq)]
102pub struct AdaTypeDeclaration {
103 pub name: String,
105 pub type_def: String,
107}
108
109impl AdaTypeDeclaration {
110 pub fn new(name: String, type_def: String) -> Self {
112 Self { name, type_def }
113 }
114}
115
116#[derive(Debug, Clone, PartialEq, Eq)]
118pub struct AdaVariableDeclaration {
119 pub name: String,
121 pub var_type: String,
123}
124
125impl AdaVariableDeclaration {
126 pub fn new(name: String, var_type: String) -> Self {
127 Self { name, var_type }
128 }
129}
130
131impl Default for AdaRoot {
132 fn default() -> Self {
133 Self::new(Vec::new())
134 }
135}