10#include <ext/algorithm>
26template <
class TerminalSymbolType,
class VariableSymbolType >
60 void addEquation ( const VariableSymbolType & from, const VariableSymbolType & to, const
regexp::UnboundedRegExpElement < TerminalSymbolType > & eq );
68 void addEquation ( const VariableSymbolType & from, const
regexp::UnboundedRegExpElement < TerminalSymbolType > & eq );
76 regexp::UnboundedRegExp < TerminalSymbolType >
solve ( const VariableSymbolType & solveFor );
112template < class TerminalSymbolType, class VariableSymbolType >
120 for (
const VariableSymbolType & symbol : removed ) {
124 for (
const VariableSymbolType & symbol : added ) {
129template <
class TerminalSymbolType,
class VariableSymbolType >
132 const VariableSymbolType & from = kv.first.first;
133 const VariableSymbolType & to = kv.first.second;
136 if ( ( from == symbol || to == symbol ) && !alt.
getElements ( ).empty ( ) ) {
142 const VariableSymbolType & from = kv.first;
145 if ( from == symbol && !alt.
getElements ( ).empty ( ) ) {
162template <
class TerminalSymbolType,
class VariableSymbolType >
175template <
class TerminalSymbolType,
class VariableSymbolType >
188template <
class TerminalSymbolType,
class VariableSymbolType >
197template <
class TerminalSymbolType,
class VariableSymbolType >
200 std::queue < VariableSymbolType > queue;
203 queue.push ( solveFor );
205 while ( ! queue.empty ( ) ) {
206 VariableSymbolType variable = std::move ( queue.front ( ) );
213 if ( kv.first.first == variable && !kv.second.getElements ( ).empty ( ) &&
visited.insert ( kv.first.second ).second )
214 queue.push ( kv.first.second );
218template <
class TerminalSymbolType,
class VariableSymbolType >
Definition: RegularEquationSolver.h:27
ext::set< VariableSymbolType > nonterminalSymbols
Definition: RegularEquationSolver.h:109
ext::map< VariableSymbolType, regexp::UnboundedRegExpAlternation< TerminalSymbolType > > equationFinal
Definition: RegularEquationSolver.h:104
void addEquation(const VariableSymbolType &from, const VariableSymbolType &to, const regexp::UnboundedRegExpElement< TerminalSymbolType > &eq)
Definition: RegularEquationSolver.h:176
virtual regexp::UnboundedRegExp< TerminalSymbolType > eliminate()=0
regexp::UnboundedRegExp< TerminalSymbolType > solve(const VariableSymbolType &solveFor)
Definition: RegularEquationSolver.h:219
void addVariableSymbol(const VariableSymbolType &symbol)
Definition: RegularEquationSolver.h:163
void setVariableSymbols(const ext::set< VariableSymbolType > &newSymbols)
Definition: RegularEquationSolver.h:113
ext::deque< VariableSymbolType > nonterminalSymbolsByDepth
Definition: RegularEquationSolver.h:94
virtual ~RegularEquationSolver() noexcept=default
ext::map< std::pair< VariableSymbolType, VariableSymbolType >, regexp::UnboundedRegExpAlternation< TerminalSymbolType > > equationTransition
Definition: RegularEquationSolver.h:99
void removeVariableSymbol(const VariableSymbolType &symbol)
Definition: RegularEquationSolver.h:130
void sortSymbolsByDepth(const VariableSymbolType &solveFor)
Definition: RegularEquationSolver.h:198
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
Represents the alternation operator in the regular expression. The node can have 0 to n children in l...
Definition: UnboundedRegExpAlternation.h:44
const ext::ptr_vector< UnboundedRegExpElement< SymbolType > > & getElements() const
Definition: UnboundedRegExpAlternation.h:185
Definition: UnboundedRegExpElement.h:62
Unbounded regular expression represents regular expression. It describes regular languages....
Definition: UnboundedRegExp.h:80
Definition: LeftRegularEquationSolver.h:13
Definition: sigHandler.cpp:20
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ToAutomaton.h:15
Definition: FordFulkerson.hpp:16