mirror of
https://github.com/ParkerTenBroeck/automata.git
synced 2026-06-07 05:28:45 -04:00
moved frontend to event driven bus, added more simulation stuff
This commit is contained in:
parent
c7309a75d9
commit
8c8bb103b2
17 changed files with 767 additions and 493 deletions
|
|
@ -152,8 +152,8 @@ pub struct Graph<'a> {
|
|||
#[wasm_bindgen(getter_with_clone)]
|
||||
pub struct CompileResult {
|
||||
pub log: Vec<CompileLog>,
|
||||
pub log_formatted: String,
|
||||
pub graph: Option<String>,
|
||||
pub ansi_log: String,
|
||||
pub machine: Option<String>,
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
|
|
@ -161,10 +161,10 @@ pub fn compile(input: &str) -> CompileResult {
|
|||
let mut ctx = Context::new(input);
|
||||
let result = automata::loader::parse_universal(&mut ctx);
|
||||
|
||||
let graph = result.map(|result| serde_json::to_string(&result).unwrap());
|
||||
let machine = result.map(|result| serde_json::to_string(&result).unwrap());
|
||||
|
||||
use std::fmt::Write;
|
||||
let log_formatted = ctx.logs_display().fold(String::new(), |mut s, e| {
|
||||
let ansi_log = ctx.logs_display().fold(String::new(), |mut s, e| {
|
||||
write!(&mut s, "{e}").unwrap();
|
||||
s
|
||||
});
|
||||
|
|
@ -190,7 +190,7 @@ pub fn compile(input: &str) -> CompileResult {
|
|||
|
||||
CompileResult {
|
||||
log,
|
||||
log_formatted,
|
||||
graph,
|
||||
ansi_log,
|
||||
machine,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue