-
Notifications
You must be signed in to change notification settings - Fork 0
/
lexico.hpp
41 lines (27 loc) · 1.08 KB
/
lexico.hpp
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
// Header Analisador Léxico
// lexico.hpp
#ifndef LEXICO_HPP
#define LEXICO_HPP
#include <iostream>
#include <string.h>
#include <fstream>
#include <list>
#include <stdio.h>
#include <vector>
using namespace std;
class Lexico{
public:
Lexico(); // Construtor default da classe
list<string> getList(); // Get para pegar a lista
int lerEntrada(ifstream *arq); // Realiza a leitura do arquivo de entrada separando os tokens em cada posição da lista
void push(string valor); // Adiciona uma string ao final da lista
void pop(); // remove a primeira string da lista
string top(); // retorna o valor no topo da lista
void imprimeLista(); // imprime a lista
int stringToInt(string str); // onde a mágica acontece, converte string para inteiro
vector <vector<int> > identificaToken(vector <vector<int> > interpretadorVector); // função de identifica os token presentes na lista
protected:
list<string> lista; // Cria a lista léxica
std::list<string>::iterator ptr; // cria um iterador de float
};
#endif