46 lines
1 KiB
Rust
46 lines
1 KiB
Rust
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||
|
|
||
|
// hide console window on Windows in release
|
||
|
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))),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
use eframe::egui;
|
||
|
|
||
|
struct MyApp {
|
||
|
tokens: Vec<Token>,
|
||
|
}
|
||
|
|
||
|
impl MyApp {
|
||
|
fn new(tokens: Vec<Token>) -> Self {
|
||
|
Self { tokens }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl eframe::App for MyApp {
|
||
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||
|
for token in &self.tokens {
|
||
|
match token {
|
||
|
Token::Tag(tag) => {
|
||
|
ui.heading(tag);
|
||
|
}
|
||
|
_ => {}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|