+/EE312

software design

git clone https://git.julia.blue/+/EE312

Joseph RyanAdd functions to blip5dbb718

master
547 B31 linesraw
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 {
11    TokenType type;
12    char data[TOK_MAX];
13    Token() {}
14    Token(const Token& other) {
15        type = other.type;
16        strcpy(data, other.data);
17    }
18    Token& operator=(const Token& other) {
19        type = other.type;
20        strcpy(data, other.data);
21        return *this;
22    }
23};
24
25extern Token current;
26
27void set_input(const char*);
28
29void advance();
30
31#endif