From 8422e2258e170c2d0221cc2352d26aff35c0e7e9 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Fri, 8 Feb 2019 18:52:34 +0100 Subject: [PATCH] user documentation of regexp transformation algos --- .../src/regexp/transform/RegExpAlternate.cpp | 15 ++++++++-- .../src/regexp/transform/RegExpAlternate.h | 24 ++++++++++++++- .../regexp/transform/RegExpConcatenate.cpp | 15 ++++++++-- .../src/regexp/transform/RegExpConcatenate.h | 24 ++++++++++++++- .../src/regexp/transform/RegExpDerivation.cpp | 30 ++++++++++++++++--- .../src/regexp/transform/RegExpDerivation.h | 28 +++++++++++++++++ .../src/regexp/transform/RegExpIntegral.cpp | 30 ++++++++++++++++--- .../src/regexp/transform/RegExpIntegral.h | 30 ++++++++++++++++++- .../src/regexp/transform/RegExpIterate.h | 11 ++++++- 9 files changed, 191 insertions(+), 16 deletions(-) diff --git a/alib2algo/src/regexp/transform/RegExpAlternate.cpp b/alib2algo/src/regexp/transform/RegExpAlternate.cpp index 6a0fa1f65b..a70b536d70 100644 --- a/alib2algo/src/regexp/transform/RegExpAlternate.cpp +++ b/alib2algo/src/regexp/transform/RegExpAlternate.cpp @@ -10,7 +10,18 @@ namespace regexp { -auto RegExpAlternateFormalRegExp = registration::AbstractRegister < RegExpAlternate, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const regexp::FormalRegExp < > & > ( RegExpAlternate::alternate ); -auto RegExpAlternateUnboundedRegExp = registration::AbstractRegister < RegExpAlternate, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const regexp::UnboundedRegExp < > & > ( RegExpAlternate::alternate ); +auto RegExpAlternateFormalRegExp = registration::AbstractRegister < RegExpAlternate, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const regexp::FormalRegExp < > & > ( RegExpAlternate::alternate, "first", "second" ).setDocumentation ( +"Implements alternation of two regular expressions.\n\ +\n\ +@param first the first regexp to alternate\n\ +@param second the second regexp to alternate\n\ +@return regexp describing first + second" ); + +auto RegExpAlternateUnboundedRegExp = registration::AbstractRegister < RegExpAlternate, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const regexp::UnboundedRegExp < > & > ( RegExpAlternate::alternate, "first", "second" ).setDocumentation ( +"Implements alternation of two regular expressions.\n\ +\n\ +@param first the first regexp to alternate\n\ +@param second the second regexp to alternate\n\ +@return regexp describing first + second" ); } /* namespace regexp */ diff --git a/alib2algo/src/regexp/transform/RegExpAlternate.h b/alib2algo/src/regexp/transform/RegExpAlternate.h index 9e8e2c7b14..fe163ee7b5 100644 --- a/alib2algo/src/regexp/transform/RegExpAlternate.h +++ b/alib2algo/src/regexp/transform/RegExpAlternate.h @@ -17,17 +17,39 @@ namespace regexp { /** - * Alternates two regexpses + * Implements alternation of two regular expressions. * */ class RegExpAlternate { public: + /** + * Implements alternation of two regular expressions. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param first the first regexp to alternate + * \param second the second regexp to alternate + * + * \return regexp describing @p first + @p second + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > alternate(const regexp::FormalRegExp < SymbolType > & first, const regexp::FormalRegExp < SymbolType > & second); + + /** + * \override + */ template < class SymbolType > static regexp::FormalRegExpStructure < SymbolType > alternate(const regexp::FormalRegExpStructure < SymbolType > & first, const regexp::FormalRegExpStructure < SymbolType > & second); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExp < SymbolType > alternate(const regexp::UnboundedRegExp < SymbolType > & first, const regexp::UnboundedRegExp < SymbolType > & second); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExpStructure < SymbolType > alternate(const regexp::UnboundedRegExpStructure < SymbolType > & first, const regexp::UnboundedRegExpStructure < SymbolType > & second); }; diff --git a/alib2algo/src/regexp/transform/RegExpConcatenate.cpp b/alib2algo/src/regexp/transform/RegExpConcatenate.cpp index d0ef54d364..31c1e78f1e 100644 --- a/alib2algo/src/regexp/transform/RegExpConcatenate.cpp +++ b/alib2algo/src/regexp/transform/RegExpConcatenate.cpp @@ -10,7 +10,18 @@ namespace regexp { -auto RegExpConcatenateFormalRegExp = registration::AbstractRegister < RegExpConcatenate, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const regexp::FormalRegExp < > & > ( RegExpConcatenate::concatenate ); -auto RegExpConcatenateUnboundedRegExp = registration::AbstractRegister < RegExpConcatenate, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const regexp::UnboundedRegExp < > & > ( RegExpConcatenate::concatenate ); +auto RegExpConcatenateFormalRegExp = registration::AbstractRegister < RegExpConcatenate, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const regexp::FormalRegExp < > & > ( RegExpConcatenate::concatenate, "first", "second" ).setDocumentation ( +"Implements concatenation of two regular expressions.\n\ +\n\ +@param first the first regexp to concatenate\n\ +@param second the second regexp to concatenate\n\ +@return regexp describing first . second" ); + +auto RegExpConcatenateUnboundedRegExp = registration::AbstractRegister < RegExpConcatenate, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const regexp::UnboundedRegExp < > & > ( RegExpConcatenate::concatenate, "first", "second" ).setDocumentation ( +"Implements concatenation of two regular expressions.\n\ +\n\ +@param first the first regexp to concatenate\n\ +@param second the second regexp to concatenate\n\ +@return regexp describing first . second" ); } /* namespace regexp */ diff --git a/alib2algo/src/regexp/transform/RegExpConcatenate.h b/alib2algo/src/regexp/transform/RegExpConcatenate.h index 9653cadc52..35e074568b 100644 --- a/alib2algo/src/regexp/transform/RegExpConcatenate.h +++ b/alib2algo/src/regexp/transform/RegExpConcatenate.h @@ -17,17 +17,39 @@ namespace regexp { /** - * Concatenates two regexpses + * Implements concatenation of two regular expressions. * */ class RegExpConcatenate { public: + /** + * Implements concatenation of two regular expressions. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param first the first regexp to concatenate + * \param second the second regexp to concatenate + * + * \return regexp describing @p first . @p second + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > concatenate(const regexp::FormalRegExp < SymbolType > & first, const regexp::FormalRegExp < SymbolType > & second); + + /** + * \override + */ template < class SymbolType > static regexp::FormalRegExpStructure < SymbolType > concatenate(const regexp::FormalRegExpStructure < SymbolType > & first, const regexp::FormalRegExpStructure < SymbolType > & second); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExp < SymbolType > concatenate(const regexp::UnboundedRegExp < SymbolType > & first, const regexp::UnboundedRegExp < SymbolType > & second); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExpStructure < SymbolType > concatenate(const regexp::UnboundedRegExpStructure < SymbolType > & first, const regexp::UnboundedRegExpStructure < SymbolType > & second); }; diff --git a/alib2algo/src/regexp/transform/RegExpDerivation.cpp b/alib2algo/src/regexp/transform/RegExpDerivation.cpp index 05f7929608..306d782698 100644 --- a/alib2algo/src/regexp/transform/RegExpDerivation.cpp +++ b/alib2algo/src/regexp/transform/RegExpDerivation.cpp @@ -10,10 +10,32 @@ namespace regexp { -auto RegExpDerivationFormalRegExpString = registration::AbstractRegister < RegExpDerivation, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const string::LinearString < > & > ( RegExpDerivation::derivation ); -auto RegExpDerivationUnboundedRegExpString = registration::AbstractRegister < RegExpDerivation, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const string::LinearString < > & > ( RegExpDerivation::derivation ); +auto RegExpDerivationFormalRegExpString = registration::AbstractRegister < RegExpDerivation, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const string::LinearString < > & > ( RegExpDerivation::derivation, "regexp", "string" ).setDocumentation ( +"Implements derivation of regular expression by a symbol sequence.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param string the sequence of symbols to derivate by\n\ +@return resulting regexp"); -auto RegExpDerivationFormalRegExpSymbol = registration::AbstractRegister < RegExpDerivation, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const DefaultSymbolType & > ( RegExpDerivation::derivation ); -auto RegExpDerivationUnboundedRegExpSymbol = registration::AbstractRegister < RegExpDerivation, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const DefaultSymbolType & > ( RegExpDerivation::derivation ); +auto RegExpDerivationUnboundedRegExpString = registration::AbstractRegister < RegExpDerivation, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const string::LinearString < > & > ( RegExpDerivation::derivation, "regexp", "string" ).setDocumentation ( +"Implements derivation of regular expression by a symbol sequence.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param string the sequence of symbols to derivate by\n\ +@return resulting regexp"); + +auto RegExpDerivationFormalRegExpSymbol = registration::AbstractRegister < RegExpDerivation, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const DefaultSymbolType & > ( RegExpDerivation::derivation, "regexp", "symbol" ).setDocumentation ( +"Implements derivation of regular expression by a symbol sequence.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param symbol the symbol to derivate by\n\ +@return resulting regexp"); + +auto RegExpDerivationUnboundedRegExpSymbol = registration::AbstractRegister < RegExpDerivation, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const DefaultSymbolType & > ( RegExpDerivation::derivation, "regexp", "symbol" ).setDocumentation ( +"Implements derivation of regular expression by a symbol sequence.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param symbol the symbol to derivate by\n\ +@return resulting regexp"); } /* namespace regexp */ diff --git a/alib2algo/src/regexp/transform/RegExpDerivation.h b/alib2algo/src/regexp/transform/RegExpDerivation.h index 8ec6750005..64e7b00a05 100644 --- a/alib2algo/src/regexp/transform/RegExpDerivation.h +++ b/alib2algo/src/regexp/transform/RegExpDerivation.h @@ -31,13 +31,41 @@ namespace regexp { */ class RegExpDerivation { public: + /** + * Implements derivation of regular expression by a symbol sequence. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param regexp the regexp to derivate + * \param string the sequence of symbols to derivate by + * + * \return resulting regexp + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > derivation(const regexp::FormalRegExp < SymbolType > & regexp, const string::LinearString < SymbolType > & string); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExp < SymbolType > derivation(const regexp::UnboundedRegExp < SymbolType > & regexp, const string::LinearString < SymbolType > & string); + /** + * Implements derivation of regular expression by a symbol. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param regexp the regexp to derivate + * \param symbol the symbol to derivate by + * + * \return resulting regexp + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > derivation(const regexp::FormalRegExp < SymbolType > & regexp, const SymbolType & symbol); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExp < SymbolType > derivation(const regexp::UnboundedRegExp < SymbolType > & regexp, const SymbolType & symbol); diff --git a/alib2algo/src/regexp/transform/RegExpIntegral.cpp b/alib2algo/src/regexp/transform/RegExpIntegral.cpp index be21116e8e..16f93c062a 100644 --- a/alib2algo/src/regexp/transform/RegExpIntegral.cpp +++ b/alib2algo/src/regexp/transform/RegExpIntegral.cpp @@ -10,10 +10,32 @@ namespace regexp { -auto RegExpIntegralFormalRegExpString = registration::AbstractRegister < RegExpIntegral, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const string::LinearString < > & > ( RegExpIntegral::integral ); -auto RegExpIntegralUnboundedRegExpString = registration::AbstractRegister < RegExpIntegral, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const string::LinearString < > & > ( RegExpIntegral::integral ); +auto RegExpIntegralFormalRegExpString = registration::AbstractRegister < RegExpIntegral, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const string::LinearString < > & > ( RegExpIntegral::integral, "regexp", "string" ).setDocumentation ( +"Implements integration of regular expression by a symbol. Result does not include the integration constant.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param string the sequence of symbols to integrate by\n\ +@return resulting regexp" ); -auto RegExpIntegralFormalRegExpSymbol = registration::AbstractRegister < RegExpIntegral, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const DefaultSymbolType & > ( RegExpIntegral::integral ); -auto RegExpIntegralUnboundedRegExpSymbol = registration::AbstractRegister < RegExpIntegral, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const DefaultSymbolType & > ( RegExpIntegral::integral ); +auto RegExpIntegralUnboundedRegExpString = registration::AbstractRegister < RegExpIntegral, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const string::LinearString < > & > ( RegExpIntegral::integral, "regexp", "string" ).setDocumentation ( +"Implements integration of regular expression by a symbol. Result does not include the integration constant.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param string the sequence of symbols to integrate by\n\ +@return resulting regexp" ); + +auto RegExpIntegralFormalRegExpSymbol = registration::AbstractRegister < RegExpIntegral, regexp::FormalRegExp < >, const regexp::FormalRegExp < > &, const DefaultSymbolType & > ( RegExpIntegral::integral, "regexp", "symbol" ).setDocumentation ( +"Implements integration of regular expression by a symbol. Result does not include the integration constant.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param symbol the symbol to integrate by\n\ +@return resulting regexp" ); + +auto RegExpIntegralUnboundedRegExpSymbol = registration::AbstractRegister < RegExpIntegral, regexp::UnboundedRegExp < >, const regexp::UnboundedRegExp < > &, const DefaultSymbolType & > ( RegExpIntegral::integral, "regexp", "symbol" ).setDocumentation ( +"Implements integration of regular expression by a symbol. Result does not include the integration constant.\n\ +\n\ +@param regexp the regexp to derivate\n\ +@param symbol the symbol to integrate by\n\ +@return resulting regexp" ); } /* namespace regexp */ diff --git a/alib2algo/src/regexp/transform/RegExpIntegral.h b/alib2algo/src/regexp/transform/RegExpIntegral.h index b84676215b..a755c82c27 100644 --- a/alib2algo/src/regexp/transform/RegExpIntegral.h +++ b/alib2algo/src/regexp/transform/RegExpIntegral.h @@ -21,18 +21,46 @@ namespace regexp { /** - * Calculates integral of regular expression + * Calculates integral of regular expression. Result does not include the integration constant. * Source: Melichar definition 2.93 in chapter 2.4.4 */ class RegExpIntegral { public: + /** + * Implements integration of regular expression by a symbol sequence. Result does not include the integration constant. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param regexp the regexp to derivate + * \param string the sequence of symbols to integrate by + * + * \return resulting regexp + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > integral(const regexp::FormalRegExp < SymbolType > & regexp, const string::LinearString < SymbolType >& string); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExp < SymbolType > integral(const regexp::UnboundedRegExp < SymbolType > & regexp, const string::LinearString < SymbolType >& string); + /** + * Implements integration of regular expression by a symbol. Result does not include the integration constant. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param regexp the regexp to derivate + * \param symbol the symbol to integrate by + * + * \return resulting regexp + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > integral(const regexp::FormalRegExp < SymbolType > & regexp, const SymbolType & symbol); + + /** + * \override + */ template < class SymbolType > static regexp::UnboundedRegExp < SymbolType > integral(const regexp::UnboundedRegExp < SymbolType > & regexp, const SymbolType & symbol); diff --git a/alib2algo/src/regexp/transform/RegExpIterate.h b/alib2algo/src/regexp/transform/RegExpIterate.h index 67bf2512fd..9947ffc923 100644 --- a/alib2algo/src/regexp/transform/RegExpIterate.h +++ b/alib2algo/src/regexp/transform/RegExpIterate.h @@ -17,11 +17,20 @@ namespace regexp { /** - * Iterates two regexpses + * Implements iteration of regular expression. * */ class RegExpIterate { public: + /** + * Implements iteration of regular expression. + * + * \tparam SymbolType the type of symbols in the regular expression + * + * \param regexp the regexp to iterate + * + * \return regexp describing @p regexp * + */ template < class SymbolType > static regexp::FormalRegExp < SymbolType > iterate(const regexp::FormalRegExp < SymbolType > & regexp); template < class SymbolType > -- GitLab