Skip to content

Ryan-Rutledge/data_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

data_generator

Arbitrary data generation library

Grammar

Data Generator provides a grammar parser that can be used to generate strings from a source file.

Run Data Generator

python -m data_generator source.txt

Randomizer Declarations

Randomizers can be created by providing a name and content:

STR_ONE
This is a string

STR_TWO
This is another string

Output

Output of the source file is designated with the __OUTPUT__ randomizer:

__OUTPUT__
This string will print when data_generator is executed.

Strings

Strings are either short (single lines with whitespace stripped), or long (interpreted literally, including whitespace and newlines). Long strings begin on a new line and are denoted with a pipe at the beginning of each line.

SHORT_STRING
   This is a short string. Extra spaces at the start will be removed.

LONG_STRING
|This is a long string.
|  Extra spaces at the beginning will be included.
|    Only the pipe delimiters will be removed.

Lists

Lists are sets of strings that randomly return one item at a time.

LIST_RANDOMIZER
- First item
- Second item
-
|Third item
|containing multiple lines
- Fourth item

RotateLists

Rotate lists are sets of strings that return each item, repeating in sequence.

LIST_RANDOMIZER
+ First item
+ Second item
+ Third item

Callers

Syntax: {RANDOMIZER}

Callers function as placeholders for randomizers. Any time a caller is included in a string, the randomizer is executed and the placeholder is changed to the output of the randomizer.

COUNT
- ten
- twenty
- thirty

__OUTPUT__
|I have {COUNT} dollars.
|You have {COUNT} dollars.

Pointers

Syntax: {<RANDOMIZER}

Pointers are very similar to callers, except that they do not generate additional content. Instead, they return the same value previously generated by the referenced randomizer.

COUNT
- ten
- twenty
- thirty

__OUTPUT__
|I have {COUNT} dollars.
|Again, I have {<COUNT} dollars.

Repeaters

Syntax: digit*string

Repeaters allow content to be generated multiple times.

__OUTPUT__
5*This string will repeat five times.

About

Arbitrary data generation library

Resources

License

Stars

Watchers

Forks

Contributors

Languages