Skip to content
Snippets Groups Projects
Commit a554b994 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix consistency detection of CNF grammar

parent 4a67feb5
No related branches found
No related tags found
No related merge requests found
......@@ -515,7 +515,7 @@ public:
static bool used ( const grammar::CNF < SymbolType > & grammar, const SymbolType & symbol ) {
for ( const std::pair < const SymbolType, ext::set < ext::variant < SymbolType, ext::pair < SymbolType, SymbolType > > > > & rule : grammar.getRules ( ) )
for ( const ext::variant < SymbolType, ext::pair < SymbolType, SymbolType > > & rhs : rule.second )
if ( ( rhs.template is < SymbolType > ( ) && ( rhs.template get < SymbolType > ( ) == symbol ) ) || ( rhs.template get < ext::pair < SymbolType, SymbolType > > ( ).first == symbol ) )
if ( ( rhs.template is < SymbolType > ( ) && ( rhs.template get < SymbolType > ( ) == symbol ) ) )
return true;
 
return false;
......@@ -568,9 +568,13 @@ public:
if ( rule.first == symbol )
return true;
 
for ( const ext::variant < SymbolType, ext::pair < SymbolType, SymbolType > > & rhs : rule.second )
if ( rhs.template get < ext::pair < SymbolType, SymbolType > > ( ).second == symbol )
for ( const ext::variant < SymbolType, ext::pair < SymbolType, SymbolType > > & rhs : rule.second ) {
if ( rhs.template is < SymbolType > ( ) )
continue;
if ( rhs.template get < ext::pair < SymbolType, SymbolType > > ( ).first == symbol || rhs.template get < ext::pair < SymbolType, SymbolType > > ( ).second == symbol )
return true;
}
 
}
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment