From abb78a0067738531339f99414264a7413dd65894 Mon Sep 17 00:00:00 2001 From: Caviar-X Date: Sat, 11 Jun 2022 12:16:52 +0800 Subject: [PATCH] inital commit : release 1.0.0 --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++- src/parser.rs | 2 +- 2 files changed, 58 insertions(+), 2 deletions(-) mode change 100644 => 100755 README.md diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 30404ce..58681ba --- a/README.md +++ b/README.md @@ -1 +1,57 @@ -TODO \ No newline at end of file +## Data Generator +a simple domain specific language which allows you to generate data fast and easy +## Usage + +Here is an example of how to generate data of a+b problem using data generator + +create a new text file named `example.txt` + +open the editor and write + +``` +{i32} {i32} +``` +execute using data generator + +```bash +## linux +./data_generator -f example.txt -c 10 +## replace `./data_generator` to `data_generator.exe` in windows +``` + +waiting for some time and it is done,how easy it is! + +## Tokens + +### single tokens + +here a some single tokens which are allow to use in data_generator + +```rust +i16 //short +i32 //int +i64 //long long +i128 //int128_t + +/*tokens start with u are all the tokens above but unsigned.So no marks here*/ +u16 +u32 +u64 +u128 + +char // A UTF-8 charaters +string //ASCII. range from 20 to 126 (that means no control charaters.Will add some later) (the maxium len are u16::MAX) +bigint //maxium len are u16::MAX +``` + +### multiple tokens + +TODO... + + + +## TODOs + +add multiple tokens (allows user to control the random data more fine) + +add documentations for the source code \ No newline at end of file diff --git a/src/parser.rs b/src/parser.rs index dfd28c8..c40a4d1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -74,7 +74,7 @@ impl Parser { }); } "string" => Ok( - repeat_with(|| thread_rng().gen_range(20_u8..126_u8) as char) + repeat_with(|| thread_rng().gen_range(10_u8..126_u8) as char) .take(random::() as usize) .collect::(), ),