Files
mosh/parser.cpp
T
2011-01-13 00:44:07 -05:00

30 lines
541 B
C++

#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 ) {
Action *exitact = state->exit();
if ( exitact ) {
ret.push_back( exitact );
}
}
if ( tx.action ) {
ret.push_back( tx.action );
}
if ( tx.next_state != NULL ) {
Action *enteract = tx.next_state->enter();
if ( enteract ) {
ret.push_back( enteract );
}
state = tx.next_state;
}
return ret;
}