-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.h
45 lines (33 loc) · 778 Bytes
/
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
42
43
44
45
#pragma once
#include "base.h"
struct FPos{
int line;
int character;
};
class Error {
public:
enum Severity {
Warning,
Breaking,
Info,
Nothing
};
Error(std::string message, Severity severity) : m(message), s(severity) {};
Error(std::string message, Severity severity, FPos pos) : m(message), s(severity), p(pos) {};
Error() : s(Severity::Nothing) {};
inline bool is_error() { if (s == Severity::Nothing) { return false; } else { return true; } }
inline std::string repr() { return m; };
private:
std::string m;
FPos p;
Severity s;
};
/*
x: int = 0; y: str = "hello world";
define add: func(x, y) ->
print x + y
define g: f(x) -> y
x^2 + 4x + 4
d/dx g(x)
graph g(x), 0, 15
*/