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

add stringApi specialisation for UnboundedRegExp

parent d1eb8859
No related branches found
No related tags found
No related merge requests found
......@@ -21,13 +21,17 @@ RegExp RegExpFromStringParser::parseRegExp(std::istream& input) {
return parseRegExp(input, ext::set<FEATURES>({FEATURES::FORMAL, FEATURES::UNBOUNDED}));
}
 
UnboundedRegExp < DefaultSymbolType > RegExpFromStringParser::parseUnboundedRegExp(std::istream& input) {
return UnboundedRegExp < DefaultSymbolType > { RegExpFromStringParser::parseUnboundedRegExpStructure ( input ) };
}
UnboundedRegExpStructure < DefaultSymbolType > RegExpFromStringParser::parseUnboundedRegExpStructure(std::istream& input) {
ext::rvalue_ref < UnboundedRegExpElement < DefaultSymbolType > > element = alternation(input);
return regexp::UnboundedRegExpStructure < DefaultSymbolType >(std::move(element));
}
 
RegExp RegExpFromStringParser::parseRegExp(std::istream& input, const ext::set<FEATURES>& features) {
UnboundedRegExp < > regexp { RegExpFromStringParser::parseUnboundedRegExpStructure ( input ) };
UnboundedRegExp < > regexp = RegExpFromStringParser::parseUnboundedRegExp ( input );
 
if(features.count(FEATURES::UNBOUNDED)) return RegExp { std::move ( regexp ) };
 
......
......@@ -31,6 +31,7 @@ class RegExpFromStringParser {
 
public:
static UnboundedRegExpStructure < DefaultSymbolType > parseUnboundedRegExpStructure(std::istream& input);
static UnboundedRegExp < DefaultSymbolType > parseUnboundedRegExp(std::istream& input);
static RegExp parseRegExp(std::istream& input);
static RegExp parseRegExp(std::istream& input, const ext::set<FEATURES>& features);
};
......
......@@ -19,6 +19,14 @@ void stringApi < regexp::RegExp >::compose ( std::ostream & output, const regexp
return regexp::RegExpToStringComposer::compose ( output, data );
}
 
regexp::UnboundedRegExp < DefaultSymbolType > stringApi < regexp::UnboundedRegExp < DefaultSymbolType > >::parse ( std::istream & input ) {
return regexp::RegExpFromStringParser::parseUnboundedRegExp ( input );
}
void stringApi < regexp::UnboundedRegExp < DefaultSymbolType > >::compose ( std::ostream & output, const regexp::UnboundedRegExp < DefaultSymbolType > & data ) {
return regexp::RegExpToStringComposer::compose ( output, data );
}
regexp::UnboundedRegExpStructure < DefaultSymbolType > stringApi < regexp::UnboundedRegExpStructure < DefaultSymbolType > >::parse ( std::istream & input ) {
return regexp::RegExpFromStringParser::parseUnboundedRegExpStructure ( input );
}
......
......@@ -20,6 +20,12 @@ struct stringApi < regexp::RegExp > {
static void compose ( std::ostream & output, const regexp::RegExp & data );
};
 
template < >
struct stringApi < regexp::UnboundedRegExp < DefaultSymbolType > > {
static regexp::UnboundedRegExp < DefaultSymbolType > parse ( std::istream & input );
static void compose ( std::ostream & output, const regexp::UnboundedRegExp < DefaultSymbolType > & data );
};
template < >
struct stringApi < regexp::UnboundedRegExpStructure < DefaultSymbolType > > {
static regexp::UnboundedRegExpStructure < DefaultSymbolType > parse ( std::istream & input );
......
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