#include <ctype.h>
#include "tokens.h"

using namespace std;
static char lexeme_buf[1024];
char *yytext = lexeme_buf;

int yylex()
{
    char ch;
    while (1) // each iteration is at the start of a new lexeme
    {
        char *p = yytext;
        if (!cin.get(ch)) // END OF FILE
            return 0;
        *p++ = ch; // add 'ch' to the end of 'yytext'
        switch (ch)
        {
            // Here is one of the single character lexemes
            case ';':
                *p = '\0'; // Null terminate yytext
                return ';';
            case ' ':
            case '\t':
                break; // skip white space

            // other cases go here

            default:
                cerr << "Unrecognized character in input: '" << char(ch) << "'\n";
                break; // try again
        }
    }
}

