-
Notifications
You must be signed in to change notification settings - Fork 2
/
header.cpp
49 lines (38 loc) · 1.11 KB
/
header.cpp
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
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include "./token.cpp"
#include "./token_list.cpp"
#include "./sintatic.cpp"
using namespace std;
void readFile(istream& file);
void getNextChar();
void getToken();
void dumpTokenList();
void scanIndentation();
void executeSintatico();
int scanIdentifier(string);
int scanKeyword(string);
int scanLiteral(string);
int scanOperator(string);
int scanDelimiter(string);
// lineText is a line read from file
std::string lineText;
// lastChar is the last char read from de line
char lastChar;
// line and columns read
int line = 0;
int column = 0;
// currentState is the current state of the analysis
enum states { initialState, stringState, numberState, keywordState, operatorDelimiterState, commentState } currentState;
// tokenType is the type of the current token
int tokenType;
// TokenList is a list with all tokens recognized
vector<Token> tokenList;
// tokenListSintatico is a list aux to check sintatic
vector<Token> tokenListSintatico;
// indentStack is the stack to control indentation
stack<int> indentStack;