-
Notifications
You must be signed in to change notification settings - Fork 7
/
errors.cpp
70 lines (52 loc) · 1.56 KB
/
errors.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// errors.cpp
// Revision 3-feb-2011
#include "errors.h"
//**********************************************************************
InternalError::InternalError(const std::string &msg) :
std::runtime_error(msg)
{
}
//**********************************************************************
CompileError::CompileError(const std::string &msg) :
std::runtime_error(msg)
{
}
CompileError::CompileError(const std::string &msg, const Token &where) :
std::runtime_error(msg + " (found: " + where.describe() + " )"),
w(where)
{
}
unsigned int CompileError::linenum() const
{
return w.linenum();
}
std::string CompileError::file() const
{
return w.file();
}
//**********************************************************************
Unsupported::Unsupported(const std::string &msg, const Token &where) :
CompileError("Unsupported feature: " + msg, where)
{
}
//**********************************************************************
UnsupportedInStage::UnsupportedInStage(const std::string &msg,
const Token &where) :
CompileError("Unsupported in stage 0: " + msg, where)
{
}
//**********************************************************************
SyntaxError::SyntaxError(const std::string &msg, const Token &where) :
CompileError("Syntax error: " + msg, where)
{
}
//**********************************************************************
Expected::Expected(char msg, const Token &where) :
SyntaxError(std::string("Expected '") + msg + '\'', where)
{
}
Expected::Expected(const std::string &msg, const Token &where) :
SyntaxError("Expected " + msg, where)
{
}
// End of errors.cpp