-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsyntaticErrors.cc
73 lines (62 loc) · 1.82 KB
/
syntaticErrors.cc
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
67
68
69
70
71
72
#include "globals.h"
#include "syntaticErrors.h"
void IntInvalidReturnError(TreeNode *t, std::string scope)
{
printf(
"\nError: Function \" %s \" is an int one, yet it is not returning anything at line %d.\n", scope.c_str(), t->lineno);
Error = TRUE;
}
void VoidInvalidReturnError(TreeNode *t, std::string scope)
{
printf(
"\nError: Function \" %s \" is a void one, yet it is returning something at line %d.\n", scope.c_str(), t->lineno);
Error = TRUE;
}
void funcAlreadyDefinedError(TreeNode *t)
{
printf(
"\nError: Function \" %s \" already defined at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void varAlreadyDefinedError(TreeNode *t)
{
printf(
"\nError: Variable \" %s \" already defined at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void varNotDefinedError(TreeNode *t)
{
printf(
"\nError: Variable \" %s \" not defined at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void funcNotDefinedError(TreeNode *t)
{
printf(
"\nError: Function \" %s \" not defined at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void DeclaredTypeNotVectorError(TreeNode *t)
{
printf(
"\nError: \" %s \" is not a vector at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void isNotFuncError(TreeNode *t)
{
printf(
"\nError: \" %s \" is not a function at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void VoidVarError(TreeNode *t)
{
printf(
"\nError: \" %s \" variable has a forbidden type at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}
void VoidVecError(TreeNode *t)
{
printf(
"\nError: \" %s \" vector has a forbidden type at line %d.\n", t->attr.name.c_str(), t->lineno);
Error = TRUE;
}