blob: 8d0d826db27732592bc6afdb7bb60d19e5418666 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* PIA - Lenguajes Modernos de Programación
* FACULTAD DE CIENCIAS FÍSICO MATEMÁTICAS
* Luis Sebastián Martínez Vega - LCC */
#include <string>
#ifndef LEXER_H
#define LEXER_H
const std::string EMPTY_STRING = "";
enum token_type{
sum,
substraction,
division,
multiplication,
power,
variable,
number,
sin,
cos,
tan,
function,
left_parens,
right_parens
};
struct Token{
token_type type;
std::string value;
};
class Lexer{
private:
std::string text;
size_t txt_ptr;
Token current_token;
void setCurrentToken(Token val);
public:
Lexer(std::string text);
void nextToken();
Token getCurrentToken();
};
#endif /* LEXER_H */
|