-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
66 lines (57 loc) · 1.28 KB
/
utils.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
/**
* @file utils.c
* @author Tomáš Hobza (xhobza03@vutbr.cz)
* @brief Utility functions for the whole project.
* @version 0.1
* @date 2023-11-24
*
* @copyright Copyright (c) 2023
* Project: IFJ compiler
*
*/
#ifndef UTILS_H
#define UTILS_H
#include "scanner.h"
#include "psa.h"
#include "colorful_printf.h"
/**
* @brief Utility function for printing the token type to a file.
*
* @param type
* @param out output file
*/
void fprint_token_type(Token_type type, FILE *out);
/**
* @brief Utility function for printing the token type.
*
* @param type
*/
void print_token_type(Token_type type);
/**
* @brief Utility function for printing the expression type to a file.
*
* @param type
* @param out output file
*/
void fprint_expression_type(Expression_type type, FILE *out);
/**
* @brief Utility function for printing the expression type to stdout.
*
* @param type
*/
void print_expression_type(Expression_type type);
/**
* @brief Converts a token to a PSA_Token.
*
* @param psa_tkn token to convert
* @return Token - converted token
*/
Token convertPSATokenToToken(PSA_Token psa_tkn);
/**
* @brief Converts a PSA_Token to a token.
*
* @param tkn token to convert
* @return PSA_Token - converted token
*/
PSA_Token convertTokenToPSAToken(Token tkn);
#endif // UTILS_H