-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.cpp
More file actions
28 lines (23 loc) · 695 Bytes
/
error.cpp
File metadata and controls
28 lines (23 loc) · 695 Bytes
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
#include "stdafx.h"
#include "error.h"
std::tuple<std::string, std::string> Error::mkError(ERROR type, const std::string &value, unsigned int line, unsigned int column)
{
std::stringstream ss(file);
std::string v;
ss << "(" << line << ":" << column << "): ";
switch (type)
{
case ERROR::SYNTAX_ERROR:
v = value;
ss << "syntax error: unexpected character [" << value << "]"; break;
case ERROR::CONSTANT_TOO_BIG:
v = value;
ss << "error: constant too big [" << value << "]"; break;
case ERROR::MODIFIER_EXPECTED:
v = ".";
ss << "syntax error: modyfier expected"; break;
default:
return std::make_tuple("unknown error", value);
}
return std::make_tuple(ss.str(), v);
}