-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.h
41 lines (36 loc) · 1.25 KB
/
error.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
/**
* Implementace překladače imperativního jazyka IFJ22
*
* @file error.h
* @author Josef Kuchař ([email protected])
* @author Matej Sirovatka ([email protected])
* @author Tomáš Běhal ([email protected])
* @author Šimon Benčík ([email protected])
* @brief Header file for error handling
*/
#ifndef __ERROR_H__
#define __ERROR_H__
// Compiler return codes
enum return_code {
RET_OK = 0, // No error
ERR_LEX = 1, // Lexical error
ERR_SYN = 2, // Syntax error
ERR_SEM_FUN = 3, // Semantic error - function (undeclared, redefinition, ...)
ERR_SEM_CALL = 4, // Semantic error - function call (wrong number of parameters, ...)
ERR_SEM_VAR = 5, // Semantic error - undefined variable
ERR_SEM_RET = 6, // Semantic error - return statement
ERR_SEM_COMP = 7, // Semantic error - incompatible types
ERR_SEM = 8, // Other semantic error
ERR_INTERNAL = 99 // Internal error (e.g. memory allocation error)
};
/**
* @brief Used when we want to exit due to some error
*
* @param code Error code
*/
void error_exit(enum return_code code);
/**
* @brief Used when something is not implemented yet
*/
void error_not_implemented();
#endif // __ERROR_H__