Replace Action with Action* so can be polymorphic

This commit is contained in:
Keith Winstein
2011-01-13 00:44:07 -05:00
parent 82ac626320
commit 59f000cdce
7 changed files with 123 additions and 107 deletions
+10 -5
View File
@@ -254,17 +254,22 @@ int vt_parser( struct stripstate *state )
/* feed to vtparse */
for ( size_t i = 0; i < out_index; i++ ) {
std::vector<Parser::Action> actions = state->parser.input( out_buffer[ i ] );
for ( std::vector<Parser::Action>::iterator j = actions.begin();
std::vector<Parser::Action *> actions = state->parser.input( out_buffer[ i ] );
for ( std::vector<Parser::Action *>::iterator j = actions.begin();
j != actions.end();
j++ ) {
if ( j->char_present ) {
printf( "%s(0x%02x=%lc) ", j->name.c_str(), j->ch, j->ch );
Parser::Action *act = *j;
assert( act );
if ( act->char_present ) {
printf( "%s(0x%02x=%lc) ", act->name.c_str(), act->ch, act->ch );
} else {
printf( "[%s] ", j->name.c_str() );
printf( "[%s] ", act->name.c_str() );
}
delete act;
fflush( stdout );
}
}