Get rid of old code from old ideas

This commit is contained in:
greg 2019-01-05 15:35:51 -08:00
parent 282c42da3c
commit 4c2e0b8a21
4 changed files with 3 additions and 54 deletions

View File

@ -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<T> {
n: T,
meta: Meta
source_map: SourceMap
}
impl<T> Node<T> {
pub fn new(n: T) -> Node<T> {
Node { n, meta: Meta::default() }
Node { n, source_map: SourceMap::default() }
}
pub fn node(&self) -> &T {
@ -22,7 +21,7 @@ impl<T> Node<T> {
//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<TypeIdentifier>);
impl From<Expression> for SourceMap<Expression> {
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<Expression>),
}
impl From<ExpressionType> for SourceMap<ExpressionType> {
fn from(node: ExpressionType) -> Self {
SourceMap { node, data: None }
}
}
#[derive(Debug, PartialEq, Clone)]
pub enum Discriminator {
Simple(Expression),

View File

@ -29,7 +29,6 @@ macro_rules! bx {
}
mod util;
mod source_map;
mod builtin;
mod tokenizing;
mod ast;

View File

@ -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<TokenKind> {
let tt = self.next();
SourceMap {
node: tt,
data: Some(SourceData { line_number: 420, char_idx: 69 })
}
}
*/
pub fn parse(&mut self) -> ParseResult<AST> {
self.program()
}

View File

@ -1,27 +0,0 @@
#[derive(Debug, Clone)]
pub struct SourceMap<T> {
pub node: T,
pub data: Option<SourceData>
}
impl<T> SourceMap<T> {
pub fn get(&self) -> &T {
&self.node
}
/*
pub fn get_source_data(&self) -> Option<SourceData> {
self.data.clone()
}
*/
}
#[derive(Debug, Clone)]
pub struct SourceData {
pub line_number: usize,
pub char_idx: usize
}