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
- Host: GitHub
- URL: https://github.com/yisar/wxml
- Owner: yisar
- License: mit
- Created: 2022-02-20T10:01:17.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-23T12:33:20.000Z (almost 4 years ago)
- Last Synced: 2025-06-18T05:43:34.475Z (7 months ago)
- Language: Rust
- Homepage: https://yisar.github.io/wxml/
- Size: 285 KB
- Stars: 41
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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})}>
}
```