Move bx macro to util

This commit is contained in:
greg 2019-07-19 22:29:02 -07:00
parent 37c77d93d7
commit 88029fc55a
3 changed files with 5 additions and 12 deletions

View File

@ -4,7 +4,7 @@
#![feature(slice_patterns, box_patterns, box_syntax)] #![feature(slice_patterns, box_patterns, box_syntax)]
//! `schala-lang` is where the Schala programming language is actually implemented. //! `schala-lang` is where the Schala programming language is actually implemented.
//! It defines the `Schala` type, which contains the state for a Schala REPL, and implements //! The crate defines the `Schala` type, which contains the state for a Schala REPL, and implements
//! `ProgrammingLanguageInterface` and the chain of compiler passes for it. //! `ProgrammingLanguageInterface` and the chain of compiler passes for it.
extern crate itertools; extern crate itertools;
@ -17,16 +17,10 @@ extern crate schala_repl;
extern crate schala_lang_codegen; extern crate schala_lang_codegen;
extern crate ena; extern crate ena;
macro_rules! bx {
($e:expr) => { Box::new($e) }
}
#[macro_use] #[macro_use]
mod util; mod util;
#[macro_use] #[macro_use]
mod typechecking; mod typechecking;
mod tokenizing; mod tokenizing;
mod ast; mod ast;
mod parsing; mod parsing;
@ -34,7 +28,6 @@ mod symbol_table;
mod builtin; mod builtin;
mod reduced_ast; mod reduced_ast;
mod eval; mod eval;
mod schala; mod schala;
pub use schala::Schala; pub use schala::Schala;

View File

@ -143,15 +143,11 @@
//! //!
mod test; mod test;
use std::rc::Rc; use std::rc::Rc;
use crate::tokenizing::*; use crate::tokenizing::*;
use crate::tokenizing::Kw::*; use crate::tokenizing::Kw::*;
use crate::tokenizing::TokenKind::*; use crate::tokenizing::TokenKind::*;
use crate::ast::*; use crate::ast::*;
use crate::builtin::{BinOp, PrefixOp}; use crate::builtin::{BinOp, PrefixOp};
/// Represents a parsing error /// Represents a parsing error

View File

@ -2,6 +2,10 @@ use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;
use std::cmp::Eq; use std::cmp::Eq;
macro_rules! bx {
($e:expr) => { Box::new($e) }
}
#[derive(Default, Debug)] #[derive(Default, Debug)]
pub struct ScopeStack<'a, T: 'a, V: 'a> where T: Hash + Eq { pub struct ScopeStack<'a, T: 'a, V: 'a> where T: Hash + Eq {
parent: Option<&'a ScopeStack<'a, T, V>>, parent: Option<&'a ScopeStack<'a, T, V>>,