Private implementation details of DFA builders.
More...
|
static bool | valarrayFullTrue (valarray< bool > const &a) |
| Tests whether all of a valarray<bool> 's entries are true . More...
|
|
|
string | initial |
| Name of the prospective DFA's initial state. More...
|
|
unordered_set< char32_t > | alphabet |
| Set of symbols processable by the prospective DFA. More...
|
|
unordered_set< string > | acceptingStates |
| Set of names of the prospective DFA's accept states. More...
|
|
unordered_map< string, unordered_map< char32_t, string > > | transitions |
| Transition function (state × symbol → state) of the prospective DFA. More...
|
|
Private implementation details of DFA builders.
Definition at line 320 of file dfa.cpp.
◆ pImpl() [1/2]
reg::dfa::builder::pImpl::pImpl |
( |
| ) |
|
|
default |
Constructs empty private implementation object.
◆ pImpl() [2/2]
reg::dfa::builder::pImpl::pImpl |
( |
string & |
initial, |
|
|
unordered_set< char32_t > & |
alphabet, |
|
|
unordered_set< string > & |
acceptingStates, |
|
|
unordered_map< string, unordered_map< char32_t, string >> & |
transitions |
|
) |
| |
|
inline |
Constructs private implementation object with provided members.
Definition at line 332 of file dfa.cpp.
unordered_map< string, unordered_map< char32_t, string > > transitions
Transition function (state × symbol → state) of the prospective DFA.
unordered_set< char32_t > alphabet
Set of symbols processable by the prospective DFA.
string initial
Name of the prospective DFA's initial state.
unordered_set< string > acceptingStates
Set of names of the prospective DFA's accept states.
◆ complete()
void reg::dfa::builder::pImpl::complete |
( |
| ) |
|
|
inline |
Totalizes a partial transition function by pointing any undefined transitions towards a trash state.
If there is no state satisfying trashiness, a new one will be generated.
Definition at line 372 of file dfa.cpp.
373 bool trashUsed(
false);
374 string const& trashState = [&]{
385 if (from.second.find(symbol) == from.second.end()) {
386 from.second[symbol] = trashState;
387 trashUsed |= (from.first != trashState);
unordered_map< string, unordered_map< char32_t, string > > transitions
Transition function (state × symbol → state) of the prospective DFA.
bool isTrashState(string const &q) const
Tests whether all of a state's outgoing transitions point to itself.
unordered_set< char32_t > alphabet
Set of symbols processable by the prospective DFA.
string const & generateNewState()
Generates a uniquely named new state and adds it to the set of states.
◆ generateNewState()
string const& reg::dfa::builder::pImpl::generateNewState |
( |
| ) |
|
|
inline |
Generates a uniquely named new state and adds it to the set of states.
Definition at line 358 of file dfa.cpp.
367 return transitions.insert(std::make_pair(newState, unordered_map<char32_t, string>())).first->first;
unordered_map< string, unordered_map< char32_t, string > > transitions
Transition function (state × symbol → state) of the prospective DFA.
string initial
Name of the prospective DFA's initial state.
◆ isTrashState()
bool reg::dfa::builder::pImpl::isTrashState |
( |
string const & |
q | ) |
const |
|
inline |
Tests whether all of a state's outgoing transitions point to itself.
Definition at line 343 of file dfa.cpp.
349 auto via = from.find(symbol);
350 if (via != from.end() && (*via).second != q) {
unordered_map< string, unordered_map< char32_t, string > > transitions
Transition function (state × symbol → state) of the prospective DFA.
unordered_set< char32_t > alphabet
Set of symbols processable by the prospective DFA.
unordered_set< string > acceptingStates
Set of names of the prospective DFA's accept states.
◆ valarrayFullTrue()
static bool reg::dfa::builder::pImpl::valarrayFullTrue |
( |
valarray< bool > const & |
a | ) |
|
|
inlinestatic |
Tests whether all of a valarray<bool>
's entries are true
.
Definition at line 409 of file dfa.cpp.
410 bool fullTrue =
true;
◆ acceptingStates
unordered_set<string> reg::dfa::builder::pImpl::acceptingStates |
Set of names of the prospective DFA's accept states.
Definition at line 323 of file dfa.cpp.
◆ alphabet
unordered_set<char32_t> reg::dfa::builder::pImpl::alphabet |
Set of symbols processable by the prospective DFA.
Definition at line 322 of file dfa.cpp.
◆ initial
string reg::dfa::builder::pImpl::initial |
Name of the prospective DFA's initial state.
Definition at line 321 of file dfa.cpp.
◆ transitions
unordered_map<string,unordered_map<char32_t,string> > reg::dfa::builder::pImpl::transitions |
Transition function (state × symbol → state) of the prospective DFA.
Also encodes the set of states in its set of keys.
Definition at line 324 of file dfa.cpp.
The documentation for this struct was generated from the following file: