#![doc = include_str!("readme.md")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaRoot {
pub items: Vec<AdaItem>,
}
impl AdaRoot {
pub fn new(items: Vec<AdaItem>) -> Self {
Self { items }
}
pub fn items(&self) -> &[AdaItem] {
&self.items
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AdaItem {
Package(AdaPackage),
Procedure(AdaProcedure),
Function(AdaFunction),
Type(AdaTypeDeclaration),
Variable(AdaVariableDeclaration),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaPackage {
pub name: String,
}
impl AdaPackage {
pub fn new(name: String) -> Self {
Self { name }
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaProcedure {
pub name: String,
pub parameters: Vec<AdaParameter>,
}
impl AdaProcedure {
pub fn new(name: String, parameters: Vec<AdaParameter>) -> Self {
Self { name, parameters }
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaFunction {
pub name: String,
pub parameters: Vec<AdaParameter>,
pub return_type: String,
}
impl AdaFunction {
pub fn new(name: String, parameters: Vec<AdaParameter>, return_type: String) -> Self {
Self { name, parameters, return_type }
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaParameter {
pub name: String,
pub param_type: String,
}
impl AdaParameter {
pub fn new(name: String, param_type: String) -> Self {
Self { name, param_type }
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaTypeDeclaration {
pub name: String,
pub type_def: String,
}
impl AdaTypeDeclaration {
pub fn new(name: String, type_def: String) -> Self {
Self { name, type_def }
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdaVariableDeclaration {
pub name: String,
pub var_type: String,
}
impl AdaVariableDeclaration {
pub fn new(name: String, var_type: String) -> Self {
Self { name, var_type }
}
}
impl Default for AdaRoot {
fn default() -> Self {
Self::new(Vec::new())
}
}