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 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 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.
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
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
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 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
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.
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 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
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.
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
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