2022-07-02 02:25:43 -05:00
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
|
|
|
|
// hide console window on Windows in release
|
2022-07-03 17:55:19 -05:00
|
|
|
use web_lisp::node::Node;
|
2022-07-02 02:25:43 -05:00
|
|
|
use web_lisp::{
|
|
|
|
lexer::{self, Token},
|
|
|
|
parser,
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let abc = lexer::lex_string(include_str!("../web_lisp_src/hello_world.wisp").to_string());
|
|
|
|
let alksjdhfhlkj = parser::parse_vec(abc.as_slice());
|
|
|
|
|
|
|
|
eframe::run_native(
|
|
|
|
"Web Lisp Browser",
|
|
|
|
eframe::NativeOptions::default(),
|
|
|
|
Box::new(|_cc| Box::new(MyApp::new(abc))),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-03 17:55:19 -05:00
|
|
|
use eframe::egui::{self, Label, RichText, TextEdit};
|
2022-07-02 02:25:43 -05:00
|
|
|
|
|
|
|
struct MyApp {
|
2022-07-03 17:55:19 -05:00
|
|
|
omnibar: String,
|
2022-07-02 02:25:43 -05:00
|
|
|
tokens: Vec<Token>,
|
2022-07-03 17:55:19 -05:00
|
|
|
root_node: Node,
|
2022-07-02 02:25:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl MyApp {
|
|
|
|
fn new(tokens: Vec<Token>) -> Self {
|
2022-07-03 17:55:19 -05:00
|
|
|
let mut root_node = Node::default();
|
|
|
|
root_node.text = "hi".to_string();
|
|
|
|
root_node.size = Some(30.0);
|
|
|
|
Self {
|
|
|
|
omnibar: "".to_string(),
|
|
|
|
tokens,
|
|
|
|
root_node,
|
|
|
|
}
|
2022-07-02 02:25:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl eframe::App for MyApp {
|
|
|
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
|
|
|
egui::CentralPanel::default().show(ctx, |ui| {
|
2022-07-03 17:55:19 -05:00
|
|
|
_frame.set_window_title("title");
|
|
|
|
ui.text_edit_singleline(&mut self.omnibar);
|
|
|
|
ui.separator();
|
|
|
|
|
|
|
|
let rn = &self.root_node;
|
|
|
|
let tx = RichText::new(rn.text.clone())
|
|
|
|
.size(rn.size.unwrap_or(12.0))
|
|
|
|
.underline();
|
|
|
|
|
|
|
|
ui.add(Label::new(tx));
|
2022-07-02 02:25:43 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|