Git Product home page Git Product logo

dwparser's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.