//---------------------------------------------------------------------------
#include "kiss_parser.h"
using namespace hub;
//---------------------------------------------------------------------------
void KissParser::run(std::istream& istr, const std::string& fn) {
    int i, o, p, s;
    std::string resetState;
    StateTableRow stateRow;
    std::list<StateTableRow> stateTable;

    l.init(istr, fn);
    token = l.NextToken();
    while( token != LEX_KISS_NULL ) {
        switch( token ) {
            case LEX_KISS_INPUT:
                token = l.NextToken();
                i = l.Lex_AInt;
                break;

            case LEX_KISS_OUTPUT:
                token = l.NextToken();
                o = l.Lex_AInt;
                break;

            case LEX_KISS_PRODUCT:
                token = l.NextToken();
                p = l.Lex_AInt;
                break;

            case LEX_KISS_STATENUMBER:
                token = l.NextToken();
                s = l.Lex_AInt;
                break;

            case LEX_KISS_RESET:
                token = l.NextToken();
                resetState = l.Lex_AStr;
                break;

            case LEX_KISS_NUMB:
            case LEX_KISS_INFO:
                //input
                stateRow.input = l.Lex_AStr;
                //current state
                token = l.NextToken();
                stateRow.currState = l.Lex_AStr;
                //next state
                token = l.NextToken();
                stateRow.nextState = l.Lex_AStr;
                //output
                token = l.NextToken();
                stateRow.output = l.Lex_AStr;
                stateTable.push_back(stateRow);
            break;
        }
        token = l.NextToken();
    }
    client_->haveDescription(i, o, stateTable, resetState, s, p);
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void KissParserClient::haveDescription(int, int, std::list<StateTableRow>&, std::string& resetState, int stateCount, int productCount) {}
//---------------------------------------------------------------------------

