🙃
This commit is contained in:
22
src/cell.rs
22
src/cell.rs
@@ -6,7 +6,8 @@ use crate::evaluator::*;
|
||||
pub struct Cell {
|
||||
eval: Eval,
|
||||
raw: String,
|
||||
deps: HashSet<CellRef>,
|
||||
i_dep: HashSet<CellRef>,
|
||||
they_dep: HashSet<CellRef>,
|
||||
}
|
||||
|
||||
impl Cell {
|
||||
@@ -14,7 +15,8 @@ impl Cell {
|
||||
Self {
|
||||
eval,
|
||||
raw,
|
||||
deps: HashSet::new(),
|
||||
i_dep: HashSet::new(),
|
||||
they_dep: HashSet::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +28,20 @@ impl Cell {
|
||||
self.eval.clone()
|
||||
}
|
||||
|
||||
pub fn add_dep(&mut self, dep: CellRef) {
|
||||
self.deps.insert(dep);
|
||||
pub fn add_i_dep(&mut self, dep: CellRef) {
|
||||
self.i_dep.insert(dep);
|
||||
}
|
||||
|
||||
pub fn clear_deps(&mut self) {
|
||||
self.deps.clear();
|
||||
pub fn add_they_dep(&mut self, dep: CellRef) {
|
||||
self.they_dep.insert(dep);
|
||||
}
|
||||
|
||||
pub fn clear_i_dep(&mut self) {
|
||||
self.i_dep.clear();
|
||||
}
|
||||
|
||||
pub fn clear_they_dep(&mut self) {
|
||||
self.they_dep.clear();
|
||||
}
|
||||
|
||||
pub fn set_eval(&mut self, eval: Eval) {
|
||||
|
||||
12
src/main.rs
12
src/main.rs
@@ -5,6 +5,10 @@ mod tokenizer;
|
||||
|
||||
use std::io;
|
||||
|
||||
use std::{io, net::SocketAddr};
|
||||
use tokio::{net::TcpListener, runtime::Runtime};
|
||||
use websocket::server::WsServer;
|
||||
|
||||
use crate::{cell::CellRef, evaluator::Evaluator};
|
||||
|
||||
fn main() {
|
||||
@@ -50,7 +54,7 @@ fn main() {
|
||||
Err(e) => println!("{}", e),
|
||||
},
|
||||
_ => {
|
||||
continue; // Impossible
|
||||
panic!("Impossible.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -58,4 +62,10 @@ fn main() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let rt = Runtime::new().unwrap();
|
||||
let handle = rt.handle().clone();
|
||||
let addr = "127.0.0.1:7050";
|
||||
|
||||
let socket = WsServer::bind(addr, handle);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ impl fmt::Display for Expr {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl Expr {
|
||||
pub fn pretty(&self) -> String {
|
||||
// entry point for users — root printed without └──
|
||||
@@ -285,5 +286,6 @@ pub fn _parse(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ok(lhs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user