comparison anagram/agcore/error.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * error.h
7 */
8
9 #ifndef ERROR_H
10 #define ERROR_H
11
12 #include "agstack.h"
13 #include "agstring.h"
14
15 class Error {
16 public:
17 enum keytype {
18 warn,
19 fatal,
20 };
21
22 AgString file;
23 int line;
24 int column;
25 keytype key;
26 AgString message;
27
28 static const char *keyString[];
29
30 Error() : line(0), column(0), key(fatal) {}
31 Error(AgString msg); // misc error
32 Error(int line, int column, AgString msg); // parse error
33 Error(int line, int column, AgString file, AgString msg); // config error
34
35 void setFatal() { key=fatal; }
36 int operator < (const Error &e) const { return line < e.line; }
37 };
38
39 extern AgStack<Error> errorList;
40
41 extern AgString errorReportFile;
42
43 extern int charRangeDiagnostic;
44 extern int eventDrivenDiagnostic;
45 extern int negativeCharDiagnostic;
46 extern int errorResynchDiagnostic;
47
48 void reset_errors(void);
49
50 void log_error();
51 void log_error(const char *);
52 void log_error(int,int);
53
54 void checkParams();
55
56
57 #endif /* ERROR_H */