diff --git a/acast2/src/cast/RegExpCastVisitor.cpp b/acast2/src/cast/RegExpCastVisitor.cpp index 262af9adac7635e3b2bbf81bc01d61c168e6064d..f09cc1284338dfc013a4a44bb5e228af6889c88f 100644 --- a/acast2/src/cast/RegExpCastVisitor.cpp +++ b/acast2/src/cast/RegExpCastVisitor.cpp @@ -6,6 +6,8 @@ */ #include "RegExpCastVisitor.h" +#include "regexp/RegExpClasses.h" + #include "../CastVisitorBase.hpp" typedef cast_base_helper< regexp::VisitableRegExpBase::const_visitor_type, regexp::RegExpBase, alib::RegExpTypes, regexp::RegExp, alib::RegExpTypes > RegExpCastVisitorType; diff --git a/alib2algo/test-src/regexp/transform/RegExpConcatenateTest.cpp b/alib2algo/test-src/regexp/transform/RegExpConcatenateTest.cpp index 2537ba7a6777a4f07d311466e2c222cfa14f94e3..d50d8d40798cb92b15518dfc75e0d80c9509ee4a 100644 --- a/alib2algo/test-src/regexp/transform/RegExpConcatenateTest.cpp +++ b/alib2algo/test-src/regexp/transform/RegExpConcatenateTest.cpp @@ -3,6 +3,7 @@ #include "regexp/transform/RegExpConcatenate.h" #include <regexp/RegExp.h> +#include <regexp/formal/FormalRegExpElements.h> #include <factory/StringDataFactory.hpp> diff --git a/alib2data/src/XmlApi.cpp b/alib2data/src/XmlApi.cpp index 5c1f6c80dda6b0700568d1934957344f3baac944..a1b1060270977732d1f3020e0909bc57c361530d 100644 --- a/alib2data/src/XmlApi.cpp +++ b/alib2data/src/XmlApi.cpp @@ -16,6 +16,7 @@ #include "automaton/AutomatonClasses.h" #include "container/ContainerClasses.h" #include "grammar/GrammarClasses.h" +#include "regexp/RegExpClasses.h" namespace alib { diff --git a/alib2data/src/object/ObjectBase.h b/alib2data/src/object/ObjectBase.h index 24ca799a4f0d9ca0180003977dcb998a8374ae13..2af6fb36da8ac3742c9e957a22610181c3c9514a 100644 --- a/alib2data/src/object/ObjectBase.h +++ b/alib2data/src/object/ObjectBase.h @@ -28,14 +28,7 @@ class UndirectedGraph; } #include "../label/LabelFeatures.h" - -namespace regexp { - -class UnboundedRegExp; -class FormalRegExp; - -} - +#include "../regexp/RegExpFeatures.h" #include "../string/StringFeatures.h" #include "../alphabet/SymbolFeatures.h" #include "../container/ContainerFeatures.h" diff --git a/alib2data/src/regexp/RegExp.h b/alib2data/src/regexp/RegExp.h index f36003ba6af6038fab06e67a9ad5b9fe63a1c3b9..7fc0106986398ea808dc0b1005cd3c158eedfb99 100644 --- a/alib2data/src/regexp/RegExp.h +++ b/alib2data/src/regexp/RegExp.h @@ -10,6 +10,7 @@ #include "../common/wrapper.hpp" #include "RegExpBase.h" + #include "../alphabet/Symbol.h" #include "../string/LinearString.h" #include <string> @@ -19,7 +20,18 @@ namespace regexp { /** * Wrapper around automata. */ -typedef alib::wrapper<RegExpBase> RegExp; +class RegExp : public alib::wrapper<RegExpBase> { +public: + explicit RegExp(RegExpBase* data) : alib::wrapper<RegExpBase>(data) { + } + + explicit RegExp(const RegExpBase& data) : alib::wrapper<RegExpBase>(data.clone()) { + } + + explicit RegExp(RegExpBase&& data) : alib::wrapper<RegExpBase>(std::move(data).plunder()) { + } + +}; regexp::RegExp regexpFrom( const std::string& string ); diff --git a/alib2data/src/regexp/RegExpAlphabetGetter.cpp b/alib2data/src/regexp/RegExpAlphabetGetter.cpp index bfe71ea9af772f09d71aaaf7aba4d07ad7a9ee8f..02cbc4c8d89e6309da8076fab2ccc3fc0aac5cef 100644 --- a/alib2data/src/regexp/RegExpAlphabetGetter.cpp +++ b/alib2data/src/regexp/RegExpAlphabetGetter.cpp @@ -6,6 +6,8 @@ */ #include "RegExpAlphabetGetter.h" +#include "RegExp.h" +#include "RegExpClasses.h" namespace regexp { diff --git a/alib2data/src/regexp/RegExpAlphabetGetter.h b/alib2data/src/regexp/RegExpAlphabetGetter.h index e7e83eb2c6cadb978ee20660d5247dc7c821b2dc..49d570c59a716f01255301798669a97232b9f1b8 100644 --- a/alib2data/src/regexp/RegExpAlphabetGetter.h +++ b/alib2data/src/regexp/RegExpAlphabetGetter.h @@ -8,11 +8,9 @@ #ifndef REG_EXP_ALPHABET_GETTER_H_ #define REG_EXP_ALPHABET_GETTER_H_ +#include "RegExpBase.h" #include <set> -#include "RegExp.h" #include "../alphabet/Symbol.h" -#include "unbounded/UnboundedRegExp.h" -#include "formal/FormalRegExp.h" namespace regexp { diff --git a/alib2data/src/regexp/RegExpClasses.h b/alib2data/src/regexp/RegExpClasses.h new file mode 100644 index 0000000000000000000000000000000000000000..aa1167ac9ea7ab44cc87e512c1d7a64863704e2b --- /dev/null +++ b/alib2data/src/regexp/RegExpClasses.h @@ -0,0 +1,14 @@ +/* + * RegExpClasses.h + * + * Created on: Jun 19, 2014 + * Author: Jan Travnicek + */ + +#ifndef REG_EXP_CLASSES_H_ +#define REG_EXP_CLASSES_H_ + +#include "unbounded/UnboundedRegExp.h" +#include "formal/FormalRegExp.h" + +#endif /* REG_EXP_CLASSES_H_ */ diff --git a/alib2data/src/regexp/RegExpFeatures.h b/alib2data/src/regexp/RegExpFeatures.h index 0cf15f29bd9453365849eb312d357a6df2886299..71d3d5e6875bc81f021b127c8394c59741d79c87 100644 --- a/alib2data/src/regexp/RegExpFeatures.h +++ b/alib2data/src/regexp/RegExpFeatures.h @@ -15,6 +15,29 @@ enum class FEATURES { UNBOUNDED }; +class RegExp; + +class UnboundedRegExp; + +class UnboundedRegExpElement; +class UnboundedRegExpAlternation; +class UnboundedRegExpConcatenation; +class UnboundedRegExpIteration; +class UnboundedRegExpSymbol; +class UnboundedRegExpEmpty; +class UnboundedRegExpEpsilon; + + +class FormalRegExp; + +class FormalRegExpElement; +class FormalRegExpAlternation; +class FormalRegExpConcatenation; +class FormalRegExpIteration; +class FormalRegExpSymbol; +class FormalRegExpEmpty; +class FormalRegExpEpsilon; + } /* namespace regexp */ #endif /* REG_EXP_FEATURES_H_ */ diff --git a/alib2data/src/regexp/RegExpFromStringLexer.h b/alib2data/src/regexp/RegExpFromStringLexer.h index 748c3fca7e3f01aab376346937e16b6689f68215..8697d19c73b1a7641e213e54bfc5953aa9923913 100644 --- a/alib2data/src/regexp/RegExpFromStringLexer.h +++ b/alib2data/src/regexp/RegExpFromStringLexer.h @@ -9,7 +9,7 @@ #define REG_EXP_FROM_STRING_LEXER_H_ #include <string> -#include <sstream> +#include <istream> namespace regexp { diff --git a/alib2data/src/regexp/RegExpFromStringParser.cpp b/alib2data/src/regexp/RegExpFromStringParser.cpp index c525ea91238898805b398b4f29ccadb267e4774d..8eca7ff0882927040a9fd302e74049f85d0ff3ee 100644 --- a/alib2data/src/regexp/RegExpFromStringParser.cpp +++ b/alib2data/src/regexp/RegExpFromStringParser.cpp @@ -6,13 +6,13 @@ */ #include "RegExpFromStringParser.h" -#include "../sax/ParserException.h" #include "../exception/AlibException.h" +#include "RegExpClasses.h" -#include "../StringApi.hpp" +#include "unbounded/UnboundedRegExpElements.h" +#include "formal/FormalRegExpElements.h" -#include "unbounded/UnboundedRegExp.h" -#include "formal/FormalRegExp.h" +#include "../StringApi.hpp" namespace regexp { diff --git a/alib2data/src/regexp/RegExpFromStringParser.h b/alib2data/src/regexp/RegExpFromStringParser.h index 962595375e020735d9866980199f2cfbfce2a432..b98d6f67413f6eb595524fc46c1dbccce7e60f7c 100644 --- a/alib2data/src/regexp/RegExpFromStringParser.h +++ b/alib2data/src/regexp/RegExpFromStringParser.h @@ -8,12 +8,10 @@ #ifndef REG_EXP_FROM_STRING_PARSER_H_ #define REG_EXP_FROM_STRING_PARSER_H_ -#include "RegExp.h" -#include "unbounded/UnboundedRegExpElements.h" -#include "formal/FormalRegExpElements.h" - -#include "RegExpFromStringLexer.h" #include "RegExpFeatures.h" +#include "RegExpFromStringLexer.h" + +#include <set> namespace alib { diff --git a/alib2data/src/regexp/RegExpFromXMLParser.cpp b/alib2data/src/regexp/RegExpFromXMLParser.cpp index 73462bd934b7aef70cc079a4dad20cab56279222..0924675f563ac88be081ae5ba1dd181a0b5be01c 100644 --- a/alib2data/src/regexp/RegExpFromXMLParser.cpp +++ b/alib2data/src/regexp/RegExpFromXMLParser.cpp @@ -7,9 +7,14 @@ #include "RegExpFromXMLParser.h" #include "../sax/ParserException.h" - #include "../XmlApi.hpp" +#include "RegExp.h" +#include "RegExpClasses.h" + +#include "unbounded/UnboundedRegExpElements.h" +#include "formal/FormalRegExpElements.h" + namespace regexp { RegExp RegExpFromXMLParser::parseRegExp(std::deque<sax::Token>::iterator& input) const { diff --git a/alib2data/src/regexp/RegExpFromXMLParser.h b/alib2data/src/regexp/RegExpFromXMLParser.h index 16811c9b9076e1b25f2d2fadf9a50cc6fb9d02df..b4669a96afa196efe49dccfb66f2ab7cbcd90740 100644 --- a/alib2data/src/regexp/RegExpFromXMLParser.h +++ b/alib2data/src/regexp/RegExpFromXMLParser.h @@ -9,14 +9,8 @@ #define REG_EXP_FROM_XML_PARSER_H_ #include "../sax/FromXMLParserHelper.h" -#include "RegExp.h" +#include <set> #include "RegExpFeatures.h" -#include "unbounded/UnboundedRegExp.h" -#include "unbounded/UnboundedRegExpElements.h" -#include "formal/FormalRegExp.h" -#include "formal/FormalRegExpElements.h" -#include "../sax/Token.h" -#include "../alphabet/Symbol.h" namespace alib { diff --git a/alib2data/src/regexp/RegExpToStringComposer.cpp b/alib2data/src/regexp/RegExpToStringComposer.cpp index 310ac72aa8f15b20693ecd8f403b8bf4b3348162..b9883a0c2dd6a78fc6417740a2f22b8bfb75d4b0 100644 --- a/alib2data/src/regexp/RegExpToStringComposer.cpp +++ b/alib2data/src/regexp/RegExpToStringComposer.cpp @@ -5,11 +5,13 @@ * Author: Martin Zak */ -#include <algorithm> #include "RegExpToStringComposer.h" +#include "RegExpClasses.h" + +#include "unbounded/UnboundedRegExpElements.h" +#include "formal/FormalRegExpElements.h" + #include "../StringApi.hpp" -#include "unbounded/UnboundedRegExp.h" -#include "formal/FormalRegExp.h" namespace regexp { diff --git a/alib2data/src/regexp/RegExpToStringComposer.h b/alib2data/src/regexp/RegExpToStringComposer.h index 18d4b5c5ccc67dacd4a6ec426c71a2a59514840e..959404e20203e38be79aa9ef28017e70dd30eddb 100644 --- a/alib2data/src/regexp/RegExpToStringComposer.h +++ b/alib2data/src/regexp/RegExpToStringComposer.h @@ -10,8 +10,8 @@ #include <string> #include "RegExp.h" -#include "unbounded/UnboundedRegExpElements.h" -#include "formal/FormalRegExpElements.h" +#include "unbounded/UnboundedRegExpElement.h" +#include "formal/FormalRegExpElement.h" namespace regexp { diff --git a/alib2data/src/regexp/RegExpToXMLComposer.cpp b/alib2data/src/regexp/RegExpToXMLComposer.cpp index 9f5175893a0cbd3c165ac508b667981ea9313d42..3d76f2705075588f38fecc225f333f27bb3c65c9 100644 --- a/alib2data/src/regexp/RegExpToXMLComposer.cpp +++ b/alib2data/src/regexp/RegExpToXMLComposer.cpp @@ -6,9 +6,13 @@ */ #include "RegExpToXMLComposer.h" - #include "../XmlApi.hpp" +#include "RegExpClasses.h" + +#include "unbounded/UnboundedRegExpElements.h" +#include "formal/FormalRegExpElements.h" + namespace regexp { void RegExpToXMLComposer::Visit(void* userData, const UnboundedRegExpAlternation& alternation) const { diff --git a/alib2data/src/regexp/RegExpToXMLComposer.h b/alib2data/src/regexp/RegExpToXMLComposer.h index 815706e63b6c74330dcc7f9bdfc83d9130cde63e..314cf322efa796a3207fc83d21fb813b7c322489 100644 --- a/alib2data/src/regexp/RegExpToXMLComposer.h +++ b/alib2data/src/regexp/RegExpToXMLComposer.h @@ -10,8 +10,8 @@ #include <deque> #include "RegExp.h" -#include "unbounded/UnboundedRegExpElements.h" -#include "formal/FormalRegExpElements.h" +#include "unbounded/UnboundedRegExpElement.h" +#include "formal/FormalRegExpElement.h" #include "../sax/Token.h" namespace alib { diff --git a/alib2data/src/string/StringAlphabetGetter.cpp b/alib2data/src/string/StringAlphabetGetter.cpp index 0061bfbf4337eddf4306a834ad33aa7f58969cb6..4e1c718a1647224d725bb42252cb70a0ad13ed8f 100644 --- a/alib2data/src/string/StringAlphabetGetter.cpp +++ b/alib2data/src/string/StringAlphabetGetter.cpp @@ -7,9 +7,7 @@ #include "StringAlphabetGetter.h" #include "String.h" -#include "Epsilon.h" -#include "LinearString.h" -#include "CyclicString.h" +#include "StringClasses.h" namespace string { diff --git a/alib2data/src/string/StringFromStringParser.cpp b/alib2data/src/string/StringFromStringParser.cpp index a86d81be4c99619e2fc94c91b54eb073ec14f91d..008f4048ea71552cdb84fca39c88702afbb78c34 100644 --- a/alib2data/src/string/StringFromStringParser.cpp +++ b/alib2data/src/string/StringFromStringParser.cpp @@ -7,9 +7,7 @@ #include "StringFromStringParser.h" #include "../exception/AlibException.h" -#include "Epsilon.h" -#include "LinearString.h" -#include "CyclicString.h" +#include "StringClasses.h" #include <vector> #include "../StringApi.hpp" diff --git a/alib2data/test-src/regexp/RegExpTest.cpp b/alib2data/test-src/regexp/RegExpTest.cpp index c0e00ceedcace5abaeada46a7d9a1e2c995e29ef..b450ffab756e6f8c3848419a3c2417aa93839d50 100644 --- a/alib2data/test-src/regexp/RegExpTest.cpp +++ b/alib2data/test-src/regexp/RegExpTest.cpp @@ -5,7 +5,9 @@ #include "sax/SaxComposeInterface.h" #include "regexp/unbounded/UnboundedRegExp.h" +#include "regexp/unbounded/UnboundedRegExpElements.h" #include "regexp/formal/FormalRegExp.h" +#include "regexp/formal/FormalRegExpElements.h" #include "factory/XmlDataFactory.hpp" #include "factory/StringDataFactory.hpp"