Skip to content
Snippets Groups Projects
Commit 9c5bd1ce authored by Jan Trávníček's avatar Jan Trávníček
Browse files

template auxiliary regexp convert algorithms

parent 1f17303f
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@
*/
 
#include "ToAutomaton.h"
#include "ToAutomatonGlushkov.h"
 
namespace regexp {
 
......@@ -16,16 +15,7 @@ automaton::Automaton ToAutomaton::convert(const regexp::RegExp& regexp) {
return dispatch(regexp.getData());
}
 
automaton::Automaton ToAutomaton::convert(const regexp::FormalRegExp < > & regexp) {
return automaton::Automaton(ToAutomatonGlushkov::convert(regexp));
}
auto ToAutomatonFormalRegExp = ToAutomaton::RegistratorWrapper<automaton::Automaton, regexp::FormalRegExp < > >(ToAutomaton::convert);
automaton::Automaton ToAutomaton::convert(const regexp::UnboundedRegExp < > & regexp) {
return automaton::Automaton(ToAutomatonGlushkov::convert(regexp));
}
auto ToAutomatonUnboundedRegExp = ToAutomaton::RegistratorWrapper<automaton::Automaton, regexp::UnboundedRegExp < > >( ToAutomaton::convert);
 
} /* namespace convert */
......
......@@ -16,6 +16,8 @@
 
#include <automaton/Automaton.h>
 
#include "ToAutomatonGlushkov.h"
namespace regexp {
 
namespace convert {
......@@ -28,11 +30,23 @@ public:
*/
static automaton::Automaton convert(const regexp::RegExp& regexp);
 
static automaton::Automaton convert(const regexp::FormalRegExp < > & regexp);
static automaton::Automaton convert(const regexp::UnboundedRegExp < > & regexp);
template < class SymbolType >
static automaton::Automaton convert(const regexp::FormalRegExp < SymbolType > & regexp);
template < class SymbolType >
static automaton::Automaton convert(const regexp::UnboundedRegExp < SymbolType > & regexp);
 
};
 
template < class SymbolType >
automaton::Automaton ToAutomaton::convert(const regexp::FormalRegExp < SymbolType > & regexp) {
return automaton::Automaton(ToAutomatonGlushkov::convert(regexp));
}
template < class SymbolType >
automaton::Automaton ToAutomaton::convert(const regexp::UnboundedRegExp < SymbolType > & regexp) {
return automaton::Automaton(ToAutomatonGlushkov::convert(regexp));
}
} /* namespace convert */
 
} /* namespace regexp */
......
......@@ -6,7 +6,6 @@
*/
 
#include "ToGrammar.h"
#include "ToGrammarRightRGGlushkov.h"
 
namespace regexp {
 
......@@ -16,16 +15,7 @@ grammar::Grammar ToGrammar::convert(const regexp::RegExp& regexp) {
return dispatch(regexp.getData());
}
 
grammar::Grammar ToGrammar::convert(const regexp::FormalRegExp < > & regexp) {
return grammar::Grammar(ToGrammarRightRGGlushkov::convert(regexp));
}
auto ToGrammarFormalRegExp = ToGrammar::RegistratorWrapper<grammar::Grammar, regexp::FormalRegExp < > >(ToGrammar::convert);
grammar::Grammar ToGrammar::convert(const regexp::UnboundedRegExp < > & regexp) {
return grammar::Grammar(ToGrammarRightRGGlushkov::convert(regexp));
}
auto ToGrammarUnboundedRegExp = ToGrammar::RegistratorWrapper<grammar::Grammar, regexp::UnboundedRegExp < > >(ToGrammar::convert);
 
} /* namespace convert */
......
......@@ -14,6 +14,8 @@
#include <regexp/RegExp.h>
#include <regexp/RegExpFeatures.h>
 
#include "ToGrammarRightRGGlushkov.h"
namespace regexp {
 
namespace convert {
......@@ -26,11 +28,23 @@ public:
*/
static grammar::Grammar convert(const regexp::RegExp& regexp);
 
static grammar::Grammar convert(const regexp::FormalRegExp < > & regexp);
static grammar::Grammar convert(const regexp::UnboundedRegExp < > & regexp);
template < class SymbolType >
static grammar::Grammar convert(const regexp::FormalRegExp < SymbolType > & regexp);
template < class SymbolType >
static grammar::Grammar convert(const regexp::UnboundedRegExp < SymbolType > & regexp);
 
};
 
template < class SymbolType >
grammar::Grammar ToGrammar::convert(const regexp::FormalRegExp < SymbolType > & regexp) {
return grammar::Grammar(ToGrammarRightRGGlushkov::convert(regexp));
}
template < class SymbolType >
grammar::Grammar ToGrammar::convert(const regexp::UnboundedRegExp < SymbolType > & regexp) {
return grammar::Grammar(ToGrammarRightRGGlushkov::convert(regexp));
}
} /* namespace convert */
 
} /* namespace regexp */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment