Skip to content

gaoqiangz/dwparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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");

About

DataWindow Syntax Parser written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages