+/EE312
software design
git clone https://git.julia.blue/+/EE312
5dbb718
master
1#ifndef LEX_H 2#define LEX_H 3 4#define TOK_MAX 128 5 6enum TokenType {ERROR = 0 ,NAME ,NUMBER ,OPERATOR ,STRING ,END }; 7 8void strcpy (char * dest ,const char * src ); 9 10struct Token { 11TokenType type ; 12char data [TOK_MAX ]; 13Token () {} 14Token (const Token & other ) { 15type = other .type ; 16strcpy (data ,other .data ); 17 } 18Token & operator = (const Token & other ) { 19type = other .type ; 20strcpy (data ,other .data ); 21return * this ; 22 } 23}; 24 25extern Token current ; 26 27void set_input (const char * ); 28 29void advance (); 30 31#endif