An open API service indexing awesome lists of open source software.

https://github.com/yisar/wxml

wxml parser rust implement
https://github.com/yisar/wxml

Last synced: 7 months ago
JSON representation

wxml parser rust implement

Awesome Lists containing this project

README

          

# wxml-parser

[wean-wxml](https://github.com/ctripcorp/wean/tree/master/wxml) rust version, compile wxml source to [fre](https://github.com/yisar/fre) jsx code.

- [Playground](https://yisar.github.io/wxml/)

### Usage

```rust
pub mod lexer;
pub mod parser;
pub mod generator;

fn main() {
let mut parser = parser::Parser::new("
hello {{item}}!
a
b

");
let ast = parser.parse_all().unwrap();
let mut gen = generator::Generator::new(ast);
let code = gen.generate_fre();
println!("{:#?}", code)
// <>{list.map((item)=>hello {item}!{a?a:b?b:ture?:null})}>
}
```