This commit is contained in:
2025-09-01 22:25:49 +10:00
parent 1e3405d51d
commit 95eb87cc24
23 changed files with 2483 additions and 7 deletions

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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)
}