-
Notifications
You must be signed in to change notification settings - Fork 0
/
Token.h
66 lines (59 loc) · 1.14 KB
/
Token.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
65
66
#ifndef TOKEN_H
#define TOKEN_H
#include <stdio.h>
#include "stdlib.h"
#include "string.h"
//#include "Token.c"
//#include "Parser.h"
extern FILE *yyin, *yyout,*semantic_out;
typedef enum eTOKENS
{
COMMA_tok,
COLON_tok,
SEMICOLON_tok,
L_PARENTHES_tok,
R_PARENTHES_tok,
L_BRACKETS_tok,
R_BRACKETS_tok,
L_CURLY_tok,
R_CURLY_tok,
EQUAL_tok,
N_EQUAL_tok,
SMALLER_tok,
SMALLER_EQUAL_tok,
BIGGER_tok,
BIGGER_EQUAL_tok,
MULTIPLE_tok,
ADDITION_tok,
ASSIGN_tok,
INT_tok,
FLOAT_tok,
if_tok,
float_KEY_tok,
int_KEY_tok,
return_tok,
void_tok,
ID_tok,
EOF_tok
}eTOKENS;
typedef struct Token
{
eTOKENS kind;
char *lexeme;
int lineNumber;
}Token;
typedef struct Node
{
Token *tokensArray;
struct Node *prev;
struct Node *next;
} Node;
void create_and_store_token(eTOKENS kind, char* lexeme, int numOfLine);
Token *next_token();
Token *back_token();
int currentIndex, backSteps;
Node* currentNode;
/* this function translates the kind integer of a token into a string (for printing)*/
const char *kindToStringConverter(eTOKENS num);
void printError(int line, char* lexeme);
#endif