-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathErrorTable.h
More file actions
78 lines (59 loc) · 2.2 KB
/
Copy pathErrorTable.h
File metadata and controls
78 lines (59 loc) · 2.2 KB
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
73
74
75
76
77
/***************************************************************************
Error.h - handles the errors
------------------------------
begin : Mon Jun 17 2002
copyright : (C) 2002 by Manuel Astudillo
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
#ifndef _GP_ERROR_H
#define _GP_ERROR_H
#include <vector>
#include "misc.h"
#include "Terminal.h"
using namespace std;
#if defined (WIN32) && defined (_USRDLL)
class __declspec(dllexport) ErrorTable;
// class __declspec(dllexport) vector <GPError*>;
#endif
typedef enum error_type {
ERROR_PARSE,
ERROR_SCAN
} error_type;
typedef enum error_value {
END_COMMENT_NOT_FOUND, // end of comment not found
UNKNOWN_TOKEN,
UNEXPECTED_TOKEN
} error_value;
class GPError {
public:
error_type type;
error_value value;
Symbol *reduction;
integer line;
integer col;
vector <wstring> expected;
vector <Symbol*> traceback;
Terminal lastTerminal;
};
class ErrorTable {
public:
vector <GPError*> errors;
ErrorTable ();
~ErrorTable ();
void addError (error_type type, error_value value , Symbol *rdc,
Terminal *lastTerminal, vector <wstring> expected,
vector <Symbol*> traceback, integer line, integer col);
void addError (error_type type, error_value value, Symbol *rdc,
integer line, integer col);
void clear ();
void print ();
// void print (const ErrorReporter &reporter);
};
#endif