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

algo: simplify run of DPDA

The variable i can be constructed from the begin and current iterator to the
input.
parent 309e93a3
No related branches found
No related tags found
1 merge request!169NPDA and NPDTA run
......@@ -838,13 +838,12 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
ext::deque < PushdownStoreSymbolType > pushdownStore {
automaton.getInitialSymbol ( )
};
unsigned i = 0;
ext::set < unsigned > occ;
 
for ( auto symbolIter = string.getContent ( ).begin ( ); symbolIter != string.getContent ( ).end ( ); ) {
 
if ( automaton.getFinalStates ( ).count ( state ) )
occ.insert ( i );
occ.insert ( std::distance ( string.getContent ( ).begin ( ), symbolIter ) );
 
if ( common::GlobalData::verbose ) {
common::Streams::log << "State : " << state << std::endl;
......@@ -873,13 +872,12 @@ ext::tuple < bool, StateType, ext::set < unsigned >, ext::deque < PushdownStoreS
state = transition->second.first;
 
if ( !std::get < 1 > ( transition->first ).is_epsilon ( ) ) {
i++;
symbolIter++;
}
}
 
if ( automaton.getFinalStates ( ).count ( state ) )
occ.insert ( i );
occ.insert ( string.getContent ( ).size ( ) );
 
if ( common::GlobalData::verbose ) {
common::Streams::log << "State: " << state << std::endl;
......
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