wxml

Crates.iowxml
lib.rswxml
version0.1.0
sourcesrc
created_at2022-02-23 12:25:18.953933
updated_at2022-02-23 12:25:18.953933
descriptionwxml parser
homepagehttps://crates.io/crates/wxml
repositoryhttps://github.com/yisar/wxml
max_upload_size
id537826
size129,228
伊撒尔 (yisar)

documentation

https://github.com/yisar/wxml

README

wxml-parser

wean-wxml rust version, compile wxml source to fre jsx code.

Usage

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>)}</>
}
Commit count: 55

cargo fmt