[][src]Crate synfuzz

Macros

choice
join_with
seq

Structs

Any

Any is a Generator that generates one character worth of value

ByteLiteral

ByteLiteral is a generator that will return the specified byte for each call of the generate method

CharLiteral

CharLiteral is a Generator that will return the specified char for each call of the generate method

CharRange

CharRange is a generator that will return bytes that represent a char between n and m inclusively. This is useful for implementing ranges of chars such as in a regular expression's character set

Choice

Choice is a Generator that will pick one of the Generators specified in 2its choices. Each call to the generate method may return a value from a different Generator

JoinWith

JoinWith is a Generator that joins a list of Generators with the specified Generator as the delimiter. In the case of the only one Generator being specified in the list no delimiter will be added. This is particularly useful when attempting to match tokens or desiring that be a separator (eg. some whitespace) between them. In that case this should be used instead of Sequence so specify the sequence of tokens for a rule.

Many

Many is a Generator that will generate 0 or more values of its generator

Many1

Many1 is a Generator that will generate 1 or more values of its generator

Not

Not is a generator that will return the negation of it's generator. The implemenation is dependent on the negate implementation for all other generators

Optional

Optional is a Generator that will optionally choose to generate exactly 1 of its generator or and empty value

Range

Range is a Generator that will produce the specified Generator between n and m times

RepeatN

RepeastN is a Generator that will product the specified Generator between 0 and n times

Rule

Rule is a Generator for invoking a named rule Generator. This is useful for implementing recursion and avoiding duplication of portions of a grammar.

SepBy

SepBy is a Generator that will repeat the generator 0 or more times separated by the specified separator. A single match will result in no separator being present, only there there is more than one

SepBy1

SepBy is a Generator that will repeat the generator 1 or more times separated by the specified separator. A single match will result in no separator being present, only there there is more than one

Sequence

Sequence is a Generator that generates all of its generators in the order in which they are specified. This is useful for sequences of specific bytes or chars but when multiple tokens are desired JoinWith is likely more helpful

StringLiteral

StringLiteral is a Generator that will return the specified string for each call of the generate method

Traits

Generator

A trait for all Generators to implement. This allows pervasive use of impl trait throughout the implementations of the various Generators and allows not specifying concrete types.

Functions

any

any is a helper to create an Any Generator

byte

byte is a helper to create a ByteLiteral Generator

ch

ch is a helper to create a CharLiteral Generator

char_range

char_range is a helper to create a CharRange Generator

choice

choice is a helper to create a Choice Generator. There is also a macro that generates the Vec and Boxes the individual generators being passed as choices for brevity and simplicity

join_with

join_with is a helper to create a JoinWith Generator. This is also a macro that handles creating the Vec and boxing the individual Generators being specified for brevity and simplicity

many

many is a helper to create a Many Generator

many1

many1 is a helper to create a Many1 Generator

not

not is a helper to generate a Not Generator

optional

optional is a helper to create an Optional Generator

range

range is a helper to create a Range Generator

register_rule

register_rule associates a tree of Generators to a name that can be later used with the Rule Generator. A rule must always be registered before a Rule Generator is executed otherwise it will lead to a panic due to an unknown rule. Rule names are case sensitive and must be unique. Attempting to register two rules with the same name will result in the last one being registered being used. This can lead to unexpected behavior.

repeat_n

repeat_n is a helper to create a RepeatN Generator

rule

rule is a helper to create a Rule Generator

sep_by

sep_by is a helper to create a SepBy Generator

sep_by1

sep_by1 is a helper to create a SepBy1 Generator

seq

seq is a helper to create a Sequence Generator. This is also a macro that handles creating the Vec and boxing the individual Generators being specified for brevity and simplicity

string

string is a helper to create a StringLiteral Generator

Type Definitions

Rules

Rules stores a map of rule name to the tree of Generators. For multithreaded applications this should be wrapped in an Arc<Mutex> to provide safe access. Realistically, as long as all rules are added before generation begins, locking should be unecessary