From aec3fd070e94e8b36c4cd37b8748f62abf70492e Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 14 Nov 2021 03:44:48 -0800 Subject: [PATCH] Remove schala-codegen crate --- Cargo.lock | 9 ------ schala-lang/codegen/Cargo.toml | 13 -------- schala-lang/codegen/src/lib.rs | 53 --------------------------------- schala-lang/language/Cargo.toml | 1 - schala-lang/language/src/lib.rs | 1 - 5 files changed, 77 deletions(-) delete mode 100644 schala-lang/codegen/Cargo.toml delete mode 100644 schala-lang/codegen/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 3b4741d..8c7cdeb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -922,21 +922,12 @@ dependencies = [ "peg", "pretty_assertions", "radix_trie", - "schala-lang-codegen", "schala-repl", "stopwatch", "take_mut", "test-case", ] -[[package]] -name = "schala-lang-codegen" -version = "0.1.0" -dependencies = [ - "quote 0.6.13", - "syn 0.15.44", -] - [[package]] name = "schala-repl" version = "0.1.0" diff --git a/schala-lang/codegen/Cargo.toml b/schala-lang/codegen/Cargo.toml deleted file mode 100644 index bf788c4..0000000 --- a/schala-lang/codegen/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "schala-lang-codegen" -version = "0.1.0" -authors = ["greg "] -edition = "2018" -resolver = "2" - -[lib] -proc-macro = true - -[dependencies] -syn = { version = "0.15.12", features = ["full", "extra-traits", "fold"] } -quote = "0.6.8" diff --git a/schala-lang/codegen/src/lib.rs b/schala-lang/codegen/src/lib.rs deleted file mode 100644 index 38dd902..0000000 --- a/schala-lang/codegen/src/lib.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![feature(box_patterns)] -#![recursion_limit="128"] -extern crate proc_macro; -#[macro_use] -extern crate quote; -#[macro_use] -extern crate syn; - -use self::proc_macro::TokenStream; -use self::syn::fold::Fold; - -struct RecursiveDescentFn { -} - -impl Fold for RecursiveDescentFn { - fn fold_item_fn(&mut self, mut i: syn::ItemFn) -> syn::ItemFn { - let box block = i.block; - let ident = &i.ident; - - let new_block: syn::Block = parse_quote! { - { - let next_token_before_parse = self.token_handler.peek(); - let record = ParseRecord { - production_name: stringify!(#ident).to_string(), - next_token: format!("{}", next_token_before_parse.to_string_with_metadata()), - level: self.parse_level, - }; - self.parse_level += 1; - self.parse_record.push(record); - let result = { #block }; - - if self.parse_level != 0 { - self.parse_level -= 1; - } - - result.map_err(|mut parse_error: ParseError| { - parse_error - }) - } - }; - i.block = Box::new(new_block); - i - } -} - -#[proc_macro_attribute] -pub fn recursive_descent_method(_attr: TokenStream, item: TokenStream) -> TokenStream { - - let input: syn::ItemFn = parse_macro_input!(item as syn::ItemFn); - let mut folder = RecursiveDescentFn {}; - let output = folder.fold_item_fn(input); - TokenStream::from(quote!(#output)) -} diff --git a/schala-lang/language/Cargo.toml b/schala-lang/language/Cargo.toml index 94026da..bd8b08f 100644 --- a/schala-lang/language/Cargo.toml +++ b/schala-lang/language/Cargo.toml @@ -18,7 +18,6 @@ assert_matches = "1.5" peg = { git = "https://github.com/kevinmehall/rust-peg", rev = "960222580c8da25b17d32c2aae6f52f902728b62" } -schala-lang-codegen = { path = "../codegen" } schala-repl = { path = "../../schala-repl" } [dev-dependencies] diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index 966facf..d208b6c 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -7,7 +7,6 @@ //! `ProgrammingLanguageInterface` and the chain of compiler passes for it. extern crate derivative; -extern crate schala_lang_codegen; extern crate schala_repl; #[macro_use]