use crate::{utils::naming::Name, Error};
use std::{any::Any, fmt::Debug};
#[derive(Debug)]
pub enum Kind<'g> {
Expression(Box<dyn Expression + 'g>),
Declaration(Box<dyn Declaration + 'g>),
Statement(Box<dyn Statement + 'g>),
}
pub enum Found {
Error(String),
Warning(String),
None,
}
#[rustfmt::skip]
pub trait Expression: Debug {
fn current_state(&self) -> Name;
fn next_state(&self) -> Name;
fn event(&self) -> Option<Name>;
fn semantic_check(&self) -> Result<Found, Error>;
fn action(&self) -> Option<&Any> {
unimplemented!("TBD")
}
}
pub trait Declaration: Debug {
fn statements(&self) -> Option<Vec<&dyn Statement>>;
fn properties(&self) -> Option<&dyn Any>;
fn expressions(&self) -> Option<Vec<&dyn Expression>>;
}
pub trait Statement: Debug {
fn state(&self) -> Option<Name>;
fn action(&self) -> Option<&Any >;
fn event(&self) -> Option<Name>;
}