diff --git a/aintegral/.cproject b/aintegral/.cproject index 2096eb1c218c48406853e475407cc241f4713b30..07e97ef0d59e955a0dac389d5b2bca2ebd7fec33 100644 --- a/aintegral/.cproject +++ b/aintegral/.cproject @@ -23,9 +23,9 @@ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1369390546" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.993968371" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1537920879" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.include.paths.2114166236" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <option id="gnu.cpp.compiler.option.include.paths.2114166236" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/alib/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/libaderivation/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/libaregexptree/src}""/> <listOptionValue builtIn="false" value="/usr/include/libxml2"/> </option> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1939414215" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> diff --git a/libaregexptree/src/RegExpAlphabet.h b/libaregexptree/src/RegExpAlphabet.h index a584656cf44cb895176250d510ba8aac7a7177f9..dcbd0e032c6f7ff76ffc1de860e5d801902f3264 100644 --- a/libaregexptree/src/RegExpAlphabet.h +++ b/libaregexptree/src/RegExpAlphabet.h @@ -9,13 +9,31 @@ #include <list> #include <set> +/** + * "Getters" for regular expression alphabet. + */ class RegExpAlphabet { public: + /** + * Returns pointers to RegExpSymbols in order as they occur in regexp tree. Used in Glushkov algorithm. + * @param re RegExp + * @return symbols of regexp tree in order of they occurence in regexp. + */ static std::list<const regexp::RegExpSymbol*> getSymbolsListInOrder( const regexp::RegExp & re ); + + /** + * @param re RegExp + * @return set of symbols appearing in regexp + */ static std::set<regexp::RegExpSymbol> getSymbols( const regexp::RegExp & re ); private: + /** + * Traverse through regexp tree and store all encountered RegExpSymbols. + * + * @param alphabet list to insert symbols + */ static void searchSymbols( const regexp::RegExpElement * element, std::list<const regexp::RegExpSymbol*> & alphabet ); }; diff --git a/libaregexptree/src/RegExpDerivation.cpp b/libaregexptree/src/RegExpDerivation.cpp index 54d5b04c6083e1d3c2b4bef03e80a74141560692..f52f5cb62c029e1513c7383ebe562bb65d015dfc 100644 --- a/libaregexptree/src/RegExpDerivation.cpp +++ b/libaregexptree/src/RegExpDerivation.cpp @@ -18,6 +18,8 @@ RegExpDerivation::RegExpDerivation( const RegExp & re ) : m_re( re ) RegExp RegExpDerivation::derivation ( const list<RegExpElement*> & dString ) const { + // TODO: change dString to WORD object when implemented. + const RegExpElement * oldRegExp = m_re.getRegExp( )->clone( ), * derivedRegExp; for( const auto & dSymbol : dString ) diff --git a/libaregexptree/src/RegExpDerivation.h b/libaregexptree/src/RegExpDerivation.h index b61df11dbaee2dc34e47f9e30188944fa229ba14..c9e0cf9504e9ac3d63dcf067d35ec4d3f5d78be2 100644 --- a/libaregexptree/src/RegExpDerivation.h +++ b/libaregexptree/src/RegExpDerivation.h @@ -26,7 +26,17 @@ class RegExpDerivation { public: + /** + * @param re RegExp to derivate + */ RegExpDerivation( const regexp::RegExp & re ); + + /** + * returns derivation of regexp over word dString + * @param dString list of RegExpElements representing word. Derivation will be over this word. + * @see RegExpElement + * @return Derivation of regexp over dString + */ regexp::RegExp derivation( const std::list<regexp::RegExpElement*> & dString ) const; private: @@ -38,7 +48,10 @@ private: regexp::RegExpElement * derivation( const regexp::RegExpEpsilon * element, const regexp::RegExpSymbol & dSymbol ) const; regexp::RegExpElement * derivation( const regexp::RegExpEmpty * element, const regexp::RegExpSymbol & dSymbol ) const; - const regexp::RegExp & m_re; + /** + * stores original regexp + */ + const regexp::RegExp m_re; }; #endif /* REGEXPDERIVATION_H_ */ diff --git a/libaregexptree/src/RegExpIntegral.cpp b/libaregexptree/src/RegExpIntegral.cpp index edbd68cfbffa7c9fb6c4815e3dfeee0e831631e7..ee5a569682972219964c10758497e52f18534aa9 100644 --- a/libaregexptree/src/RegExpIntegral.cpp +++ b/libaregexptree/src/RegExpIntegral.cpp @@ -17,6 +17,8 @@ RegExpIntegral::RegExpIntegral( const RegExp & re ) : m_re( re ) RegExp RegExpIntegral::integral( const list<RegExpElement*> & dString ) const { + // TODO: change dString to WORD object when implemented. + const RegExpElement * oldRegExp = m_re.getRegExp( )->clone( ), * integralRegExp; for( auto it = dString.rbegin( ); it != dString.rend( ); it ++ ) diff --git a/libaregexptree/src/RegExpIntegral.h b/libaregexptree/src/RegExpIntegral.h index 4acc909880a85ba321139dd1025ee611ab8610a5..15b27a4c80560b387190bb143f5ae78b61f71d38 100644 --- a/libaregexptree/src/RegExpIntegral.h +++ b/libaregexptree/src/RegExpIntegral.h @@ -13,10 +13,23 @@ #include <regexp/RegExp.h> #include <regexp/RegExpElements.h> +/** + * Computes integral of regular expression as defined in Melichar, 2.93 (chapter 2.4.4) + */ class RegExpIntegral { public: + /** + * @param re RegExp to integrate + */ RegExpIntegral( const regexp::RegExp & re ); + + /** + * returns integral of regexp over word dString + * @param dString list of RegExpElements representing word. Integral will be over this word. + * @see RegExpElement + * @return Integral of regexp over dString + */ regexp::RegExp integral( const std::list<regexp::RegExpElement*> & dString ) const; private: @@ -28,7 +41,10 @@ private: regexp::RegExpElement * integral( const regexp::RegExpEpsilon * node, const regexp::RegExpSymbol & dSymbol ) const; regexp::RegExpElement * integral( const regexp::RegExpEmpty * node, const regexp::RegExpSymbol & dSymbol ) const; - const regexp::RegExp & m_re; + /** + * stores original regular expression + */ + const regexp::RegExp m_re; }; #endif /* REGEXPINTEGRAL_H_ */