diff --git a/alib2data/src/rte/common/RTEFromXMLParser.cpp b/alib2data/src/rte/common/RTEFromXMLParser.cpp index 9254a8615f04f11291b3ad37699d8cdb20d75eda..118259457e322335eb711013650e483a6bcdcf1c 100644 --- a/alib2data/src/rte/common/RTEFromXMLParser.cpp +++ b/alib2data/src/rte/common/RTEFromXMLParser.cpp @@ -67,6 +67,7 @@ std::rvalue_ref < FormalRTEAlternation > RTEFromXMLParser::parseFormalRTEAlterna std::rvalue_ref < FormalRTESubstitution > RTEFromXMLParser::parseFormalRTESubstitution ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "substitution" ); + // TODO: Check alphabet membership std::rvalue_ref < FormalRTESymbolSubst > ssymb ( new FormalRTESymbolSubst ( alib::xmlApi < alphabet::RankedSymbol >::parse ( input ) ) ); std::rvalue_ref < FormalRTEElement > element1 = parseFormalRTEElement ( input ); std::rvalue_ref < FormalRTEElement > element2 = parseFormalRTEElement ( input ); @@ -80,6 +81,7 @@ std::rvalue_ref < FormalRTESubstitution > RTEFromXMLParser::parseFormalRTESubsti std::rvalue_ref < FormalRTEIteration > RTEFromXMLParser::parseFormalRTEIteration ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "iteration" ); + // TODO: Check alphabet membership std::rvalue_ref < FormalRTESymbolSubst > ssymb ( new FormalRTESymbolSubst ( alib::xmlApi < alphabet::RankedSymbol >::parse ( input ) ) ); std::rvalue_ref < FormalRTEElement > element = parseFormalRTEElement ( input ); std::rvalue_ref < FormalRTEIteration > iteration ( new FormalRTEIteration ( std::move ( element ), std::move ( ssymb ) ) ); @@ -112,6 +114,7 @@ std::rvalue_ref < FormalRTESymbolAlphabet > RTEFromXMLParser::parseFormalRTESymb alphabet::RankedSymbol symbol = alib::xmlApi < alphabet::RankedSymbol >::parse ( input ); std::vector < std::rvalue_ref < FormalRTESymbol > > elements; + // TODO: Check alphabet membership std::rvalue_ref < FormalRTESymbolAlphabet > ret ( new FormalRTESymbolAlphabet ( symbol ) ); while ( sax::FromXMLParserHelper::isTokenType ( input, sax::Token::TokenType::START_ELEMENT ) ) @@ -129,6 +132,7 @@ std::rvalue_ref < FormalRTESymbolSubst > RTEFromXMLParser::parseFormalRTESymbolS sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "substSymbol" ); alphabet::RankedSymbol symbol = alib::xmlApi < alphabet::RankedSymbol >::parse ( input ); + // TODO: Check alphabet membership std::rvalue_ref < FormalRTESymbolSubst > ret ( new FormalRTESymbolSubst ( symbol ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, "substSymbol" ); diff --git a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.cpp b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.cpp index 1c0ac404a80e3c1ed609bfcda0a726507323fe2f..9759db6dd42259877750230c7e7e12836837055f 100644 --- a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.cpp +++ b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.cpp @@ -94,8 +94,11 @@ bool FormalRTESymbolAlphabet::attachRTE ( const FormalRTE * regexp ) { return this->parentRTE->getAlphabet ( ).find ( this->symbol ) != this->parentRTE->getAlphabet ( ).end ( ) || this->parentRTE->getConstantAlphabet ( ).find ( this->symbol ) == this->parentRTE->getConstantAlphabet ( ).end ( ); } -void FormalRTESymbolAlphabet::computeMinimalAlphabet ( std::set < alphabet::RankedSymbol > & alphabetF, std::set < alphabet::RankedSymbol > & /* alphabetK */ ) const { +void FormalRTESymbolAlphabet::computeMinimalAlphabet ( std::set < alphabet::RankedSymbol > & alphabetF, std::set < alphabet::RankedSymbol > & alphabetK ) const { alphabetF.insert ( this->symbol ); + + for ( const auto & child : elements ) + child->computeMinimalAlphabet ( alphabetF, alphabetK ); } FormalRTESymbolAlphabet::operator std::string ( ) const {