#include <context_free_grammar_generator.hpp>
Classes | |
struct | nonterminal |
Public Member Functions | |
context_free_grammar_generator (const std::string &source) | |
Initialisation. More... | |
context_free_grammar_generator (const std::map< std::string, std::vector< std::string >> &source) | |
Initialisation. More... | |
std::string | generate () const override |
Generates a possible word in the grammar set before. More... | |
~context_free_grammar_generator () | |
Public Member Functions inherited from name_generator | |
std::string | generate (const std::map< std::string, std::string > &variables) const |
name_generator () | |
virtual | ~name_generator () |
Private Member Functions | |
void | init_seed (uint32_t seed[]) const |
std::string | print_nonterminal (const std::string &name, uint32_t seed[], short int seed_pos) const |
Private Attributes | |
std::map< std::string, nonterminal > | nonterminals_ |
Static Private Attributes | |
static const short unsigned int | seed_size = 20 |
Definition at line 23 of file context_free_grammar_generator.hpp.
context_free_grammar_generator::context_free_grammar_generator | ( | const std::string & | source | ) |
Initialisation.
source | the definition of the context-free grammar to use |
Definition at line 38 of file context_free_grammar_generator.cpp.
References nonterminals_.
context_free_grammar_generator::context_free_grammar_generator | ( | const std::map< std::string, std::vector< std::string >> & | source | ) |
Initialisation.
source | A map of nonterminals to lists of possibilities |
Definition at line 97 of file context_free_grammar_generator.cpp.
References c, nonterminals_, and utils::trim().
context_free_grammar_generator::~context_free_grammar_generator | ( | ) |
Definition at line 34 of file context_free_grammar_generator.cpp.
|
overridevirtual |
Generates a possible word in the grammar set before.
Reimplemented from name_generator.
Definition at line 170 of file context_free_grammar_generator.cpp.
References init_seed(), print_nonterminal(), and seed_size.
|
private |
Definition at line 176 of file context_free_grammar_generator.cpp.
References randomness::generator, i, randomness::rng::next_random(), and seed_size.
Referenced by generate().
|
private |
Definition at line 134 of file context_free_grammar_generator.cpp.
References ERR_WML, i, context_free_grammar_generator::nonterminal::last_, lg::log_to_chat(), nonterminals_, context_free_grammar_generator::nonterminal::possibilities_, and seed_size.
Referenced by generate().
|
private |
Definition at line 34 of file context_free_grammar_generator.hpp.
Referenced by context_free_grammar_generator(), and print_nonterminal().
|
staticprivate |
Definition at line 36 of file context_free_grammar_generator.hpp.
Referenced by generate(), init_seed(), and print_nonterminal().