use crate::token::Token;
use std::collections::HashMap;
use std::vec::Vec;
pub enum MacroData {
DirectReplace(Vec<Token>),
Function(usize, Vec<Token>),
}
pub struct IfStackData {
pub processed: bool, pub current: bool, }
pub struct PreprocessorContext {
pub define_map: HashMap<String, MacroData>,
pub if_stack: Vec<IfStackData>,
}
impl PreprocessorContext {
pub fn new() -> Self {
Self {
define_map: HashMap::new(),
if_stack: Vec::new(),
}
}
pub fn should_emit(&self) -> bool {
if self.if_stack.is_empty() {
true
} else {
self.if_stack.last().unwrap().current
}
}
}