1pub struct DiagnoseStream(pub Vec<Diagnostic>);
2
3
4pub static mut DIAGNOSTIC_STREAM:DiagnoseStream = DiagnoseStream(Vec::new());
5impl DiagnoseStream {
6 pub fn push(&mut self, v: Diagnostic) {
7 self.0.push(v);
8 }
9 pub fn pop(&mut self) -> Option<Diagnostic> {
10 return self.0.pop();
11 }
12}
13#[derive(PartialEq, Debug, Eq, PartialOrd, Ord, Clone)]
14pub struct Diagnostic {
15 pub location: (String, usize)
16}
17
18#[macro_export]
19macro_rules! diagnose_push {
20 ($v:expr) => {
21 unsafe {toyc::diagnostics::DIAGNOSTIC_STREAM.push($v)}
22 };
23}
24
25#[macro_export]
26macro_rules! diagnose_pop {
27 () => {
28 unsafe {toyc::diagnostics::DIAGNOSTIC_STREAM.pop()}
29 };
30}