Crates.io | wxml |
lib.rs | wxml |
version | 0.1.0 |
source | src |
created_at | 2022-02-23 12:25:18.953933 |
updated_at | 2022-02-23 12:25:18.953933 |
description | wxml parser |
homepage | https://crates.io/crates/wxml |
repository | https://github.com/yisar/wxml |
max_upload_size | |
id | 537826 |
size | 129,228 |
wean-wxml rust version, compile wxml source to fre jsx code.
pub mod lexer;
pub mod parser;
pub mod generator;
fn main() {
let mut parser = parser::Parser::new("<view wx:for=\"{{list}}\">
hello {{item}}!
<text wx:if=\"{{a}}\">a</text>
<text wx:elseif=\"{{b}}\">b</text>
<text wx:else />
</view>");
let ast = parser.parse_all().unwrap();
let mut gen = generator::Generator::new(ast);
let code = gen.generate_fre();
println!("{:#?}", code)
// <>{list.map((item)=><View>hello {item}!{a?<Text>a</Text>:b?<Text>b</Text>:ture?<Text/>:null}</View>)}</>
}