turtle-build 0.4.9

Ninja-compatible build system for high-level programming languages
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::ast;
use std::sync::Arc;
use train_map::TrainMap;

#[derive(Clone, Debug)]
pub struct ModuleState<'a, 'm> {
    pub rules: TrainMap<'m, &'a str, ast::Rule>,
    pub variables: TrainMap<'m, &'a str, Arc<str>>,
}

impl<'m> ModuleState<'_, 'm> {
    pub fn fork(&'m self) -> Self {
        Self {
            rules: self.rules.fork(),
            variables: self.variables.fork(),
        }
    }
}