parsing of lisp files is working
This commit is contained in:
parent
87a26642fa
commit
9695c8670f
4
justfile
4
justfile
|
@ -2,8 +2,8 @@ default:
|
||||||
just --list
|
just --list
|
||||||
build:
|
build:
|
||||||
RUST_LOG=debug cargo build
|
RUST_LOG=debug cargo build
|
||||||
run ui=' ' file='~/dev/lumina-iced/testypres.lisp':
|
run ui=' ' file='~/dev/lumina-iced/test_presentation.lisp':
|
||||||
RUST_LOG=debug cargo run -- {{ui}} {{file}}
|
RUST_LOG=debug cargo run -- -i {{ui}} {{file}}
|
||||||
clean:
|
clean:
|
||||||
RUST_LOG=debug cargo clean
|
RUST_LOG=debug cargo clean
|
||||||
test:
|
test:
|
||||||
|
|
19
src/lisp.rs
19
src/lisp.rs
|
@ -1,3 +1,5 @@
|
||||||
|
use std::{fs::read_to_string, path::PathBuf};
|
||||||
|
|
||||||
use crisp::types::{Symbol, Value};
|
use crisp::types::{Symbol, Value};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
@ -21,7 +23,20 @@ pub fn parse_lisp(value: Value) -> Vec<Slide> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Value::Symbol(Symbol(s)) if s == "load" => {
|
Value::Symbol(Symbol(s)) if s == "load" => {
|
||||||
vec![Slide::default()]
|
let Ok(path) = PathBuf::from(String::from(&vec[1]))
|
||||||
|
.canonicalize()
|
||||||
|
else {
|
||||||
|
return vec![Slide::default()];
|
||||||
|
};
|
||||||
|
let lisp = read_to_string(path).expect("oops");
|
||||||
|
let lisp_value = crisp::reader::read(&lisp);
|
||||||
|
match lisp_value {
|
||||||
|
Value::List(value) => value
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(|v| parse_lisp(v))
|
||||||
|
.collect(),
|
||||||
|
_ => panic!("Should not be"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
},
|
},
|
||||||
|
@ -77,6 +92,8 @@ mod test {
|
||||||
assert_eq!(first_lisp_slide, &test_vec[0]);
|
assert_eq!(first_lisp_slide, &test_vec[0]);
|
||||||
assert_eq!(second_lisp_slide, &test_vec[1]);
|
assert_eq!(second_lisp_slide, &test_vec[1]);
|
||||||
assert_eq!(third_lisp_slide, &test_vec[2]);
|
assert_eq!(third_lisp_slide, &test_vec[2]);
|
||||||
|
|
||||||
|
assert_eq!(slide_vec, test_vec);
|
||||||
}
|
}
|
||||||
_ => panic!("this should be a lisp"),
|
_ => panic!("this should be a lisp"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,9 +98,9 @@ And my life began"))
|
||||||
(song :author "Jordan Feliz" :ccli 97987
|
(song :author "Jordan Feliz" :ccli 97987
|
||||||
:font "Quicksand" :font-size 80
|
:font "Quicksand" :font-size 80
|
||||||
:title "The River"
|
:title "The River"
|
||||||
:background (video :source "./coolerbg.mkv" :fit cover)
|
:background (video :source "~/vids/test/camprules2024theo.mp4" :fit cover)
|
||||||
:verse-order (v1 c1 v2 c1)
|
:verse-order (v1 c1 v2 c1)
|
||||||
(v1 "I'm going down to the river")
|
(v1 "I'm going down to the river")
|
||||||
(c1 "Down to the river")
|
(c1 "Down to the river")
|
||||||
(v2 "Down to the river to pray ay ay!"))
|
(v2 "Down to the river to pray ay ay!"))
|
||||||
(load "./10000-reasons.lisp")
|
(load "./test_song.lisp")
|
||||||
|
|
Loading…
Reference in a new issue