Implemented parser

This commit is contained in:
Keith Winstein
2011-01-09 04:39:51 -05:00
parent 2f70137df0
commit d8ac8c15c2
5 changed files with 42 additions and 8 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "parser.hpp"
std::vector<Parser::Action> Parser::Parser::input( wchar_t ch )
{
std::vector<Action> ret;
Transition tx = state->input( ch );
if ( tx.next_state != NULL ) {
ret.push_back( state->exit() );
}
ret.push_back( tx.action );
if ( tx.next_state != NULL ) {
ret.push_back( tx.next_state->enter() );
state = tx.next_state;
}
return ret;
}