From 53bc81ed07ada4d67bbc260b18e25f68dfbb4cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz> Date: Mon, 7 Apr 2014 13:08:08 +0200 Subject: [PATCH] libaregexptree: Remove RegExpAlphabet - Removal of libaregexptree/RegExpAlphabet - Method getting regexp alphabet moved to alib/RegExp, alib/RegExpElement - Method getting get symbols list in order moved to aconversion/GlushkovTraversal as Glushkov algorithm is the only one using it - Reflect changes throughout project --- aconversions/src/re2fa/Brzozowski.cpp | 5 +- aconversions/src/re2fa/Brzozowski.h | 1 - aconversions/src/re2fa/Glushkov.cpp | 4 +- aconversions/src/re2fa/Glushkov.h | 2 - aconversions/src/re2fa/Thompson.cpp | 2 +- aconversions/src/re2fa/Thompson.h | 2 - .../re2rg/re2rrg/BrzozowskiDerivationRRG.cpp | 3 +- .../re2rg/re2rrg/BrzozowskiDerivationRRG.h | 1 - aconversions/src/re2rg/re2rrg/GlushkovRRG.cpp | 4 +- aconversions/src/re2rg/re2rrg/GlushkovRRG.h | 2 - aconversions/src/shared/GlushkovTraversal.cpp | 55 +++++++++++++++ aconversions/src/shared/GlushkovTraversal.h | 14 ++++ alib/src/regexp/Alternation.cpp | 5 ++ alib/src/regexp/Alternation.h | 5 ++ alib/src/regexp/Concatenation.cpp | 5 ++ alib/src/regexp/Concatenation.h | 5 ++ alib/src/regexp/Iteration.cpp | 4 ++ alib/src/regexp/Iteration.h | 5 ++ alib/src/regexp/RegExp.cpp | 9 +++ alib/src/regexp/RegExp.h | 8 +++ alib/src/regexp/RegExpElement.cpp | 4 ++ alib/src/regexp/RegExpElement.h | 10 +++ alib/src/regexp/RegExpSymbol.cpp | 4 ++ alib/src/regexp/RegExpSymbol.h | 11 ++- libaregexptree/src/RegExpAlphabet.cpp | 69 ------------------- libaregexptree/src/RegExpAlphabet.h | 40 ----------- 26 files changed, 150 insertions(+), 129 deletions(-) delete mode 100644 libaregexptree/src/RegExpAlphabet.cpp delete mode 100644 libaregexptree/src/RegExpAlphabet.h diff --git a/aconversions/src/re2fa/Brzozowski.cpp b/aconversions/src/re2fa/Brzozowski.cpp index 42beed5d6e..3c2048ace6 100644 --- a/aconversions/src/re2fa/Brzozowski.cpp +++ b/aconversions/src/re2fa/Brzozowski.cpp @@ -6,7 +6,6 @@ */ #include "Brzozowski.h" -#include <iostream> using namespace alib; using namespace automaton; @@ -31,7 +30,7 @@ FSM Brzozowski::convert( void ) // 1. RegExp V = opt.optimize( m_re ); - set<RegExpSymbol> alphabet = RegExpAlphabet::getSymbols( m_re ); + set<alphabet::Symbol> alphabet = m_re.getAlphabet( ); set<RegExp> Q = { V }; deque<set<RegExp>> Qi; @@ -129,7 +128,7 @@ const State & Brzozowski::StateBuilder::getState( const RegExp & re ) const { auto state = m_states.find( re ); if( state != m_states.end() ) return state->second; - + throw AlibException( "Brzozowski::StateBuilder - Regular expression not found!" ); } diff --git a/aconversions/src/re2fa/Brzozowski.h b/aconversions/src/re2fa/Brzozowski.h index 2263d402e0..d455ff5308 100644 --- a/aconversions/src/re2fa/Brzozowski.h +++ b/aconversions/src/re2fa/Brzozowski.h @@ -19,7 +19,6 @@ #include "RegExpDerivation.h" -#include "RegExpAlphabet.h" #include "RegExpOptimize.h" namespace conversions diff --git a/aconversions/src/re2fa/Glushkov.cpp b/aconversions/src/re2fa/Glushkov.cpp index 98fa8e88ea..8d12338345 100644 --- a/aconversions/src/re2fa/Glushkov.cpp +++ b/aconversions/src/re2fa/Glushkov.cpp @@ -31,7 +31,7 @@ FSM Glushkov::convert( void ) // step 1 initNumberSymbols( ); - for( const auto & symbol : RegExpAlphabet::getSymbols( m_re ) ) + for( const auto & symbol : m_re.getAlphabet( ) ) m_fsm.addInputSymbol( symbol.getSymbol( ) ); // steps 2, 3, 4 @@ -73,7 +73,7 @@ void Glushkov::initNumberSymbols( void ) { int id = 1; - for( const auto & symb : RegExpAlphabet::getSymbolsListInOrder( m_re ) ) + for( const auto & symb : GlushkovTraversal::getSymbolsListInOrder( m_re ) ) m_numberedSymbols.insert( pair<const RegExpSymbol*, NumberedSymbol>( symb, NumberedSymbol( symb, id ++ ) ) ); } diff --git a/aconversions/src/re2fa/Glushkov.h b/aconversions/src/re2fa/Glushkov.h index 6fdc3d9f0a..d5002c13d4 100644 --- a/aconversions/src/re2fa/Glushkov.h +++ b/aconversions/src/re2fa/Glushkov.h @@ -18,8 +18,6 @@ #include "AbstractREtoFAConverter.h" #include "../shared/GlushkovTraversal.h" -#include "RegExpAlphabet.h" - namespace conversions { diff --git a/aconversions/src/re2fa/Thompson.cpp b/aconversions/src/re2fa/Thompson.cpp index f5f72e3132..e0e17d6cc1 100644 --- a/aconversions/src/re2fa/Thompson.cpp +++ b/aconversions/src/re2fa/Thompson.cpp @@ -26,7 +26,7 @@ Thompson::~Thompson( void ) FSM Thompson::convert( void ) { - for( const auto & symbol : RegExpAlphabet::getSymbols( m_re ) ) + for( const auto & symbol : m_re.getAlphabet( ) ) m_fsm.addInputSymbol( symbol.getSymbol( ) ); SubexpressionTails st = processRegExpNode( m_re.getRegExp( ) ); diff --git a/aconversions/src/re2fa/Thompson.h b/aconversions/src/re2fa/Thompson.h index 76d5a5d15d..3ba43932c7 100644 --- a/aconversions/src/re2fa/Thompson.h +++ b/aconversions/src/re2fa/Thompson.h @@ -17,8 +17,6 @@ #include "AbstractREtoFAConverter.h" -#include "RegExpAlphabet.h" - namespace conversions { diff --git a/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.cpp b/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.cpp index afd359c626..a0798d9c29 100644 --- a/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.cpp +++ b/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.cpp @@ -6,7 +6,6 @@ */ #include "BrzozowskiDerivationRRG.h" -#include <iostream> using namespace alib; using namespace alphabet; @@ -33,7 +32,7 @@ RightRegularGrammar BrzozowskiDerivationRRG::convert( void ) // 1. RegExp V = opt.optimize( m_re ); - set<RegExpSymbol> alphabet = RegExpAlphabet::getSymbols( m_re ); + set<Symbol> alphabet = m_re.getAlphabet( ); set<RegExp> N = { V }; deque<set<RegExp>> Ni; diff --git a/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.h b/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.h index a656f8c79f..47b1546dcc 100644 --- a/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.h +++ b/aconversions/src/re2rg/re2rrg/BrzozowskiDerivationRRG.h @@ -18,7 +18,6 @@ #include "AbstractREtoRRGConverter.h" -#include "RegExpAlphabet.h" #include "RegExpOptimize.h" #include "RegExpDerivation.h" diff --git a/aconversions/src/re2rg/re2rrg/GlushkovRRG.cpp b/aconversions/src/re2rg/re2rrg/GlushkovRRG.cpp index 4416d1fcb6..845294fd4e 100644 --- a/aconversions/src/re2rg/re2rrg/GlushkovRRG.cpp +++ b/aconversions/src/re2rg/re2rrg/GlushkovRRG.cpp @@ -29,7 +29,7 @@ GlushkovRRG::~GlushkovRRG( void ) RightRegularGrammar GlushkovRRG::convert( void ) { // step 1 - for( const auto & symbol : RegExpAlphabet::getSymbols( m_re ) ) + for( const auto & symbol : m_re.getAlphabet( ) ) m_grammar.addTerminalSymbol( symbol.getSymbol( ) ); initNumberSymbols( ); @@ -102,7 +102,7 @@ void GlushkovRRG::initNumberSymbols( void ) { int id = 1; - for( const auto & symb : RegExpAlphabet::getSymbolsListInOrder( m_re ) ) + for( const auto & symb : GlushkovTraversal::getSymbolsListInOrder( m_re ) ) m_numberedSymbols.insert( pair<const RegExpSymbol*, NumberedSymbol>( symb, NumberedSymbol( symb, m_grammar, id ++ ) ) ); } diff --git a/aconversions/src/re2rg/re2rrg/GlushkovRRG.h b/aconversions/src/re2rg/re2rrg/GlushkovRRG.h index 78d48eb00c..1588df99f3 100644 --- a/aconversions/src/re2rg/re2rrg/GlushkovRRG.h +++ b/aconversions/src/re2rg/re2rrg/GlushkovRRG.h @@ -16,8 +16,6 @@ #include "../../shared/GlushkovTraversal.h" #include "AbstractREtoRRGConverter.h" -#include "RegExpAlphabet.h" - namespace conversions { diff --git a/aconversions/src/shared/GlushkovTraversal.cpp b/aconversions/src/shared/GlushkovTraversal.cpp index d9971752ca..897e106e43 100644 --- a/aconversions/src/shared/GlushkovTraversal.cpp +++ b/aconversions/src/shared/GlushkovTraversal.cpp @@ -293,4 +293,59 @@ set<GlushkovTraversal::Neighbours> GlushkovTraversal::getNeighbours( const RegEx return set<Neighbours>( ); } +// ---------------------------------------------------------------------------- + +list<const RegExpSymbol*> GlushkovTraversal::getSymbolsListInOrder( const RegExp & re ) +{ + list<const RegExpSymbol*> alphabet; + + getSymbolsListInOrder( re.getRegExp( ), alphabet ); + + return alphabet; +} + +void GlushkovTraversal::getSymbolsListInOrder( const RegExpElement * node, list<const RegExpSymbol*> & alphabet ) +{ + const Alternation* alternation = dynamic_cast<const Alternation*>( node ); + const Concatenation* concatenation = dynamic_cast<const Concatenation*>( node ); + const Iteration* iteration = dynamic_cast<const Iteration*>( node ); + const RegExpSymbol* symbol = dynamic_cast<const RegExpSymbol*>( node ); + const RegExpEmpty * empty = dynamic_cast<const RegExpEmpty*>( node ); + const RegExpEpsilon* eps = dynamic_cast<const RegExpEpsilon*>( node ); + + if( symbol ) + { + alphabet.push_back( symbol ); + return; + } + + else if( alternation ) + { + for( const auto & element : alternation->getElements( ) ) + getSymbolsListInOrder( element, alphabet ); + return; + } + + else if( concatenation ) + { + for( const auto & element : concatenation->getElements( ) ) + getSymbolsListInOrder( element, alphabet ); + return; + } + + else if( iteration ) + { + getSymbolsListInOrder( iteration->getElement( ), alphabet ); + return; + } + + else if( empty ) + return; + + else if( eps ) + return; + + throw AlibException( "GlushkovTraversal::getSymbolsListInOrder() - unknown RegExpElement node" ); +} + } /* namespace conversions */ diff --git a/aconversions/src/shared/GlushkovTraversal.h b/aconversions/src/shared/GlushkovTraversal.h index 09c7928214..018bbb159b 100644 --- a/aconversions/src/shared/GlushkovTraversal.h +++ b/aconversions/src/shared/GlushkovTraversal.h @@ -9,6 +9,7 @@ #define GLUSHKOVTRAVERSAL_H_ #include <set> +#include <list> #include <regexp/RegExp.h> #include <regexp/RegExpElement.h> @@ -56,6 +57,14 @@ public: */ static std::set<Neighbours> getNeighbours( const regexp::RegExp & re ); + /** + * Returns pointers to RegExpSymbols in order as they occur in regexp. + * + * @param re RegExp to probe + * @return symbols of regexp tree in order of they occurence in regexp. + */ + static std::list<const regexp::RegExpSymbol*> getSymbolsListInOrder( const regexp::RegExp & re ); + private: static std::set<const regexp::RegExpSymbol*> getLeftmostSymbolsInTree( const regexp::RegExpElement * node ); static std::set<const regexp::RegExpSymbol*> getLeftmostSymbolsInTree( const regexp::Alternation * node ); @@ -80,6 +89,11 @@ private: static std::set<Neighbours> getNeighbours( const regexp::RegExpSymbol * node ); static std::set<Neighbours> getNeighbours( const regexp::RegExpEmpty * node ); static std::set<Neighbours> getNeighbours( const regexp::RegExpEpsilon * node ); + + /** + * @see GlushkovTraversal::getSymbolsListInOrder() + */ + static void getSymbolsListInOrder( const regexp::RegExpElement * node, std::list<const regexp::RegExpSymbol*> & alphabet ); }; } /* namespace conversions */ diff --git a/alib/src/regexp/Alternation.cpp b/alib/src/regexp/Alternation.cpp index aac9219f55..7a92bf6f65 100644 --- a/alib/src/regexp/Alternation.cpp +++ b/alib/src/regexp/Alternation.cpp @@ -99,6 +99,11 @@ bool Alternation::operator==(const Alternation& other) const { return true; } +void Alternation::getAlphabet( std::set<alphabet::Symbol> & alphabet ) const { + for(const auto& child : this->elements) + child->getAlphabet(alphabet); +} + bool Alternation::containsEmptyString() const { for(const auto& e : getElements()) if(e->containsEmptyString()) diff --git a/alib/src/regexp/Alternation.h b/alib/src/regexp/Alternation.h index d5f5c94622..320c7fa6da 100644 --- a/alib/src/regexp/Alternation.h +++ b/alib/src/regexp/Alternation.h @@ -51,6 +51,11 @@ public: virtual bool operator<(const Alternation&) const; virtual bool operator==(const Alternation&) const; + /** + * @copydoc RegExpElement::getAlphabet() + */ + virtual void getAlphabet( std::set<alphabet::Symbol> & alphabet ) const; + /** * @copydoc RegExpElement::containsEmptyString() const */ diff --git a/alib/src/regexp/Concatenation.cpp b/alib/src/regexp/Concatenation.cpp index 087f14074e..b678958ac9 100644 --- a/alib/src/regexp/Concatenation.cpp +++ b/alib/src/regexp/Concatenation.cpp @@ -95,6 +95,11 @@ bool Concatenation::operator==(const Concatenation& other) const { return true; } +void Concatenation::getAlphabet( std::set<alphabet::Symbol> & alphabet ) const { + for(const auto& child : this->elements) + child->getAlphabet(alphabet); +} + bool Concatenation::containsEmptyString() const { for(const auto& e : getElements()) if( ! e->containsEmptyString()) diff --git a/alib/src/regexp/Concatenation.h b/alib/src/regexp/Concatenation.h index 955c6b765b..f195f3e3cb 100644 --- a/alib/src/regexp/Concatenation.h +++ b/alib/src/regexp/Concatenation.h @@ -50,6 +50,11 @@ public: virtual bool operator<(const Concatenation&) const; virtual bool operator==(const Concatenation&) const; + /** + * @copydoc RegExpElement::getAlphabet() + */ + virtual void getAlphabet( std::set<alphabet::Symbol> & alphabet ) const; + /** * @copydoc RegExpElement::containsEmptyString() const */ diff --git a/alib/src/regexp/Iteration.cpp b/alib/src/regexp/Iteration.cpp index 3495f4a6bc..888985fa09 100644 --- a/alib/src/regexp/Iteration.cpp +++ b/alib/src/regexp/Iteration.cpp @@ -93,6 +93,10 @@ bool Iteration::operator==(const Iteration& other) const { return *(this->element) == *(other.element); } +void Iteration::getAlphabet( std::set<alphabet::Symbol> & alphabet ) const { + element->getAlphabet( alphabet ); +} + bool Iteration::containsEmptyString() const { return true; } diff --git a/alib/src/regexp/Iteration.h b/alib/src/regexp/Iteration.h index f5e1f2c5c6..9b3e8c5072 100644 --- a/alib/src/regexp/Iteration.h +++ b/alib/src/regexp/Iteration.h @@ -58,6 +58,11 @@ public: virtual bool operator<(const Iteration&) const; virtual bool operator==(const Iteration&) const; + /** + * @copydoc RegExpElement::getAlphabet() + */ + virtual void getAlphabet( std::set<alphabet::Symbol> & alphabet ) const; + /** * @copydoc RegExpElement::containsEmptyString() const */ diff --git a/alib/src/regexp/RegExp.cpp b/alib/src/regexp/RegExp.cpp index 246a5ee7eb..5f7571ae1f 100644 --- a/alib/src/regexp/RegExp.cpp +++ b/alib/src/regexp/RegExp.cpp @@ -70,6 +70,15 @@ void RegExp::setRegExp(RegExpElement* regExp) { this->regExp = regExp; } +set<alphabet::Symbol> RegExp::getAlphabet(void) const{ + set<alphabet::Symbol> alphabet; + + if(regExp) + regExp->getAlphabet( alphabet ); + + return alphabet; +} + bool RegExp::isEmpty() const { return regExp == NULL || regExp->isEmpty(); } diff --git a/alib/src/regexp/RegExp.h b/alib/src/regexp/RegExp.h index 9f6e624842..528cfb5024 100644 --- a/alib/src/regexp/RegExp.h +++ b/alib/src/regexp/RegExp.h @@ -14,6 +14,8 @@ #include "RegExpElement.h" #include "RegExpEmpty.h" +#include "../alphabet/Symbol.h" + namespace regexp { using namespace std; @@ -55,6 +57,12 @@ public: */ void setRegExp(RegExpElement* regExp); + /** + * Gets alphabet symbols used in RegExp. + * @return set of alphabet symbols used in regexp. + */ + std::set<alphabet::Symbol> getAlphabet(void) const; + /** * @return true if regexp represents empty language */ diff --git a/alib/src/regexp/RegExpElement.cpp b/alib/src/regexp/RegExpElement.cpp index fc07c4c1f0..7dddc07ea2 100644 --- a/alib/src/regexp/RegExpElement.cpp +++ b/alib/src/regexp/RegExpElement.cpp @@ -75,4 +75,8 @@ bool RegExpElement::operator==(const RegExpEmpty& other) const { return false; } +void RegExpElement::getAlphabet( std::set<alphabet::Symbol> & alphabet ) const { + // default: do nothing. +} + } /* namespace regexp */ diff --git a/alib/src/regexp/RegExpElement.h b/alib/src/regexp/RegExpElement.h index 186fe7c3b0..2337635f61 100644 --- a/alib/src/regexp/RegExpElement.h +++ b/alib/src/regexp/RegExpElement.h @@ -8,6 +8,9 @@ #ifndef REGEXPELEMENT_H_ #define REGEXPELEMENT_H_ +#include <set> +#include "../alphabet/Symbol.h" + namespace regexp { using namespace std; @@ -65,6 +68,13 @@ public: * @return true if this subtree describes empty language */ virtual bool isEmpty() const = 0; + + /** + * Traverses the regexp tree to get alphabet symbols used. + * + * @param alphabet All alphabet symbols encountered are added into this set + */ + virtual void getAlphabet( std::set<alphabet::Symbol> & alphabet ) const; }; } /* namespace regexp */ diff --git a/alib/src/regexp/RegExpSymbol.cpp b/alib/src/regexp/RegExpSymbol.cpp index f71609fc71..140eee9f52 100644 --- a/alib/src/regexp/RegExpSymbol.cpp +++ b/alib/src/regexp/RegExpSymbol.cpp @@ -62,6 +62,10 @@ bool RegExpSymbol::isEmpty() const { return false; } +void RegExpSymbol::getAlphabet( std::set<alphabet::Symbol> & alphabet ) const { + alphabet.insert( Symbol( this->getSymbol( ) ) ); +} + const string& RegExpSymbol::getSymbol() const { return this->symbol; } diff --git a/alib/src/regexp/RegExpSymbol.h b/alib/src/regexp/RegExpSymbol.h index ce0a6b6055..167cc5f1da 100644 --- a/alib/src/regexp/RegExpSymbol.h +++ b/alib/src/regexp/RegExpSymbol.h @@ -41,14 +41,21 @@ public: virtual bool operator<(const RegExpSymbol&) const; virtual bool operator==(const RegExpSymbol&) const; + /** + * @copydoc RegExpElement::getAlphabet() + */ + virtual void getAlphabet( std::set<alphabet::Symbol> & alphabet ) const; + + /** + * @return Returns string representation of symbol. + */ + const string& getSymbol() const; /** * @copydoc RegExpElement::containsEmptyString() const */ virtual bool containsEmptyString() const; - const string& getSymbol() const; - /** * @copydoc RegExpElement::isEmpty() const */ diff --git a/libaregexptree/src/RegExpAlphabet.cpp b/libaregexptree/src/RegExpAlphabet.cpp deleted file mode 100644 index d39a7183fa..0000000000 --- a/libaregexptree/src/RegExpAlphabet.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "RegExpAlphabet.h" - -using namespace alib; -using namespace alphabet; -using namespace regexp; -using namespace std; - -set<RegExpSymbol> RegExpAlphabet::getSymbols( const RegExp & re ) -{ - set<RegExpSymbol> alphabet; - - for( const auto & symbol : getSymbolsListInOrder( re ) ) - alphabet.insert( RegExpSymbol( symbol->getSymbol( ) ) ); - - return alphabet; -} - -list<const RegExpSymbol*> RegExpAlphabet::getSymbolsListInOrder( const RegExp & re ) -{ - list<const RegExpSymbol*> alphabet; - searchSymbols( re.getRegExp( ), alphabet ); - return alphabet; -} - - -void RegExpAlphabet::searchSymbols( const RegExpElement * node, list<const RegExpSymbol*> & alphabet ) -{ - const Alternation* alternation = dynamic_cast<const Alternation*>( node ); - const Concatenation* concatenation = dynamic_cast<const Concatenation*>( node ); - const Iteration* iteration = dynamic_cast<const Iteration*>( node ); - const RegExpSymbol* symbol = dynamic_cast<const RegExpSymbol*>( node ); - const RegExpEmpty * empty = dynamic_cast<const RegExpEmpty*>( node ); - const RegExpEpsilon* eps = dynamic_cast<const RegExpEpsilon*>( node ); - - if( symbol ) - { - alphabet.push_back( symbol ); - return; - } - - else if( alternation ) - { - for( const auto & element : alternation->getElements( ) ) - searchSymbols( element, alphabet ); - return; - } - - else if( concatenation ) - { - for( const auto & element : concatenation->getElements( ) ) - searchSymbols( element, alphabet ); - return; - } - - else if( iteration ) - { - searchSymbols( iteration->getElement( ), alphabet ); - return; - } - - else if( empty ) - return; - - else if( eps ) - return; - - - throw AlibException( "RegExpAlphabet::traverseSymbols() - unknown RegExpElement node" ); -} diff --git a/libaregexptree/src/RegExpAlphabet.h b/libaregexptree/src/RegExpAlphabet.h deleted file mode 100644 index dcbd0e032c..0000000000 --- a/libaregexptree/src/RegExpAlphabet.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef REGEXPALPHABET_H_ -#define REGEXPALPHABET_H_ - -#include <regexp/RegExp.h> -#include <regexp/RegExpElements.h> - -#include <AlibException.h> - -#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 ); -}; - -#endif /* REGEXPALPHABET_H_ */ -- GitLab