wip: add whitespace parsing to rsx
This commit is contained in:
1 parent
5313fc0cc6
commit
181a51a63b
14 files changed
+278
-24
No files matched your search
@@ -0,0 +1,38 @@
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use dioxus_rsx::{BodyNode, CallBody};
|
||||
|
||||
const LINE_WIDTH: usize = 80;
|
||||
|
||||
pub struct Printer {
|
||||
buf: String,
|
||||
// queue: Vec<Item>,
|
||||
}
|
||||
|
||||
pub enum Break {
|
||||
// Space flexes to line if need be
|
||||
Space,
|
||||
|
||||
// Line always forces a new line
|
||||
// Comments are an example of this
|
||||
Line,
|
||||
}
|
||||
|
||||
// enum Item {
|
||||
// BreakBegin,
|
||||
// BreakEnd,
|
||||
// Text(Cow<'static, str>),
|
||||
// }
|
||||
|
||||
impl Printer {
|
||||
fn doit(&mut self, body: CallBody) {
|
||||
for node in body.roots {}
|
||||
}
|
||||
fn node(&mut self, node: BodyNode) {}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let src = r#"div {}"#;
|
||||
let contents: CallBody = syn::parse_str(src).unwrap();
|
||||
}
|
||||
@@ -27,3 +27,6 @@ twoway! ("tinynoopt" => tinynoopt);
|
||||
twoway! ("long" => long);
|
||||
|
||||
twoway! ("key" => key);
|
||||
|
||||
// Disabled because we can't handle comments on exprs yet
|
||||
twoway! ("multirsx" => multirsx);
|
||||
@@ -0,0 +1,30 @@
|
||||
rsx! {
|
||||
|
||||
// hi
|
||||
div {}
|
||||
|
||||
// hi
|
||||
div { abcd, ball, s }
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
div { abcd, ball, s }
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
div {
|
||||
//
|
||||
abcd,
|
||||
|
||||
//
|
||||
ball,
|
||||
|
||||
//
|
||||
s,
|
||||
|
||||
//
|
||||
"asdasd"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user