From 4c2e0b8a2176cb1387970af36b7a0d130ac55bff Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 5 Jan 2019 15:35:51 -0800 Subject: [PATCH] Get rid of old code from old ideas --- schala-lang/language/src/ast.rs | 18 +++-------------- schala-lang/language/src/lib.rs | 1 - schala-lang/language/src/parsing.rs | 11 ----------- schala-lang/language/src/source_map.rs | 27 -------------------------- 4 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 schala-lang/language/src/source_map.rs diff --git a/schala-lang/language/src/ast.rs b/schala-lang/language/src/ast.rs index 660cbf8..3c01436 100644 --- a/schala-lang/language/src/ast.rs +++ b/schala-lang/language/src/ast.rs @@ -1,18 +1,17 @@ use std::rc::Rc; use std::convert::From; -use source_map::{SourceMap}; use builtin::{BinOp, PrefixOp}; #[derive(Clone, Debug, PartialEq)] pub struct Node { n: T, - meta: Meta + source_map: SourceMap } impl Node { pub fn new(n: T) -> Node { - Node { n, meta: Meta::default() } + Node { n, source_map: SourceMap::default() } } pub fn node(&self) -> &T { @@ -22,7 +21,7 @@ impl Node { //TODO this PartialEq is here to make tests work - find a way to make it not necessary #[derive(Clone, Debug, Default, PartialEq)] -struct Meta { +struct SourceMap { } #[derive(Debug, PartialEq)] @@ -86,11 +85,6 @@ pub enum Variant { #[derive(Debug, PartialEq, Clone)] pub struct Expression(pub ExpressionType, pub Option); -impl From for SourceMap { - fn from(node: Expression) -> Self { - SourceMap { node, data: None } - } -} #[derive(Debug, PartialEq, Clone)] pub enum TypeIdentifier { @@ -146,12 +140,6 @@ pub enum ExpressionType { ListLiteral(Vec), } -impl From for SourceMap { - fn from(node: ExpressionType) -> Self { - SourceMap { node, data: None } - } -} - #[derive(Debug, PartialEq, Clone)] pub enum Discriminator { Simple(Expression), diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index f66027a..57d060e 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -29,7 +29,6 @@ macro_rules! bx { } mod util; -mod source_map; mod builtin; mod tokenizing; mod ast; diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index 98d76fb..cf3b220 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -6,7 +6,6 @@ use tokenizing::*; use tokenizing::Kw::*; use tokenizing::TokenKind::*; -use source_map::{SourceMap, SourceData}; use ast::*; use builtin::{BinOp, PrefixOp}; @@ -87,16 +86,6 @@ impl Parser { self.token_handler.next() } - /* - fn next_mapped(&mut self) -> SourceMap { - let tt = self.next(); - SourceMap { - node: tt, - data: Some(SourceData { line_number: 420, char_idx: 69 }) - } - } - */ - pub fn parse(&mut self) -> ParseResult { self.program() } diff --git a/schala-lang/language/src/source_map.rs b/schala-lang/language/src/source_map.rs deleted file mode 100644 index d8452f4..0000000 --- a/schala-lang/language/src/source_map.rs +++ /dev/null @@ -1,27 +0,0 @@ - -#[derive(Debug, Clone)] -pub struct SourceMap { - pub node: T, - pub data: Option -} - -impl SourceMap { - pub fn get(&self) -> &T { - &self.node - } - - /* - pub fn get_source_data(&self) -> Option { - self.data.clone() - } - */ -} - -#[derive(Debug, Clone)] -pub struct SourceData { - pub line_number: usize, - pub char_idx: usize -} - - -