Get rid of old code from old ideas
This commit is contained in:
parent
282c42da3c
commit
4c2e0b8a21
@ -1,18 +1,17 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
|
|
||||||
use source_map::{SourceMap};
|
|
||||||
use builtin::{BinOp, PrefixOp};
|
use builtin::{BinOp, PrefixOp};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct Node<T> {
|
pub struct Node<T> {
|
||||||
n: T,
|
n: T,
|
||||||
meta: Meta
|
source_map: SourceMap
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Node<T> {
|
impl<T> Node<T> {
|
||||||
pub fn new(n: 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 {
|
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
|
//TODO this PartialEq is here to make tests work - find a way to make it not necessary
|
||||||
#[derive(Clone, Debug, Default, PartialEq)]
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
struct Meta {
|
struct SourceMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
@ -86,11 +85,6 @@ pub enum Variant {
|
|||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct Expression(pub ExpressionType, pub Option<TypeIdentifier>);
|
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)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum TypeIdentifier {
|
pub enum TypeIdentifier {
|
||||||
@ -146,12 +140,6 @@ pub enum ExpressionType {
|
|||||||
ListLiteral(Vec<Expression>),
|
ListLiteral(Vec<Expression>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ExpressionType> for SourceMap<ExpressionType> {
|
|
||||||
fn from(node: ExpressionType) -> Self {
|
|
||||||
SourceMap { node, data: None }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum Discriminator {
|
pub enum Discriminator {
|
||||||
Simple(Expression),
|
Simple(Expression),
|
||||||
|
@ -29,7 +29,6 @@ macro_rules! bx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod util;
|
mod util;
|
||||||
mod source_map;
|
|
||||||
mod builtin;
|
mod builtin;
|
||||||
mod tokenizing;
|
mod tokenizing;
|
||||||
mod ast;
|
mod ast;
|
||||||
|
@ -6,7 +6,6 @@ use tokenizing::*;
|
|||||||
use tokenizing::Kw::*;
|
use tokenizing::Kw::*;
|
||||||
use tokenizing::TokenKind::*;
|
use tokenizing::TokenKind::*;
|
||||||
|
|
||||||
use source_map::{SourceMap, SourceData};
|
|
||||||
use ast::*;
|
use ast::*;
|
||||||
|
|
||||||
use builtin::{BinOp, PrefixOp};
|
use builtin::{BinOp, PrefixOp};
|
||||||
@ -87,16 +86,6 @@ impl Parser {
|
|||||||
self.token_handler.next()
|
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> {
|
pub fn parse(&mut self) -> ParseResult<AST> {
|
||||||
self.program()
|
self.program()
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user