-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lexico.h
64 lines (57 loc) · 881 Bytes
/
Lexico.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include <fstream>
#include <iostream>
#include <limits>
using namespace std;
enum tipoToken {
identificador,
entero,
real,
String,
TIPO,
opSuma,
opMul,
opRel,
opOR,
opAND,
opNOT,
opIgualdad,
puntoComa,
coma,
parent_ini,
parent_fin,
llave_ini,
llave_fin,
EQUAL,
IF,
WHILE,
RETURN,
ELSE,
pesos
};
class Token
{
private:
int tipo = 23;
std::string cad;
public:
Token(int tipo, std::string cad);
Token();
int GetTipo();
std::string GetCad();
~Token();
};
class Lexico
{
public:
Lexico();
Lexico(fstream& in);
virtual ~Lexico();
Token lex();
std::string cadena;
protected:
private:
int index = 0, edo = 0;
std::string c;
std::string entrada;
};