use crate::{expression::Expression, scope::ManagedVar};
use proc_macro2::{Span, TokenStream};
use syn::{Ident, Type, token::Mut};
#[derive(Clone, Debug)]
pub enum Statement {
Local {
variable: ManagedVar,
init: Option<Box<Expression>>,
span: Option<Span>,
},
Define {
name: Ident,
kind: DefineKind,
init: Box<Expression>,
},
Expression {
expression: Box<Expression>,
terminated: bool,
span: Option<Span>,
},
Verbatim {
tokens: TokenStream,
},
}
impl Statement {
pub fn span(&self) -> Option<Span> {
match self {
Statement::Local { span, .. } | Statement::Expression { span, .. } => *span,
Statement::Define { .. } | Statement::Verbatim { .. } => None,
}
}
}
pub struct Pattern {
pub ident: Ident,
pub ty: Option<Type>,
pub is_ref: bool,
pub mutability: Option<Mut>,
}
#[derive(Clone, Copy, Debug)]
pub enum DefineKind {
Type,
Size,
}