dwparser

Crates.iodwparser
lib.rsdwparser
version0.1.3
sourcesrc
created_at2023-01-17 08:26:54.095333
updated_at2023-01-17 14:48:34.206734
descriptionDataWindow Syntax Parser
homepage
repositoryhttps://github.com/gaoqiangz/dwparser
max_upload_size
id760859
size1,943,830
(gaoqiangz)

documentation

https://docs.rs/dwparser

README

dwparser

github
crates.io docs.rs version BSD-2-Clause licensed

DataWindow Syntax Parser written in Rust

功能

  • 解析DataWindow语法生成语法树AST,修改AST并重新生成DataWindow语法字符串
  • 兼容DataWindow::Modify/Describe函数的语法,并且可以修改任何语法项

Feature flags

Flag Description Default
preserve_order 保留原始语法项的顺序 enabled
case_insensitive 忽略大小写 false
query 支持modifydescribe操作 false
serde_support 支持serde序列化接口 false
full 开启所有特性 false

环境要求

  • rustc: 最低1.54 (支持stable)

开始使用

  • cargo add
> cargo add dwparser
  • 或手动添加依赖到Cargo.toml
[dependencies]
dwparser = "0.1.0"

示例

  • 修改processing
let mut dwsyn = dwparser::parse("{DataWindow Syntax}").unwrap();
dwsyn.modify("DataWindow.Processing = 2");
  • 修改字段类型
let mut dwsyn = dwparser::parse("{DataWindow Syntax}").unwrap();
//通过字段名
dwsyn.modify("DataWindow.Table.Column.ColA.ColType = char(255)");
//通过ID
dwsyn.modify("DataWindow.Table.Column.1.ColType = char(255)");
  • 删除字段
let mut dwsyn = dwparser::parse("{DataWindow Syntax}").unwrap();
//通过字段名
dwsyn.modify("Destroy DataWindow.Table.Column.ColA");
//通过ID
dwsyn.modify("Destroy DataWindow.Table.Column.1");
  • 删除分组
let mut dwsyn = dwparser::parse("{DataWindow Syntax}").unwrap();
dwsyn.modify("Destroy DataWindow.Footer.1");
Commit count: 46

cargo fmt