source: dev/branches/egtra/ab5.0/abdev/BasicCompiler_Common/include/Messenger.h@ 812

Last change on this file since 812 was 812, checked in by イグトランス (egtra), 13 years ago

LexicalAnalyzer_Typedef.cppをcompiler-implへ移動。

File size: 1.6 KB
Line 
1#pragma once
2
3class Messenger
4{
5public:
6 void Output( const std::string &message );
7 int GetNextErrorLine();
8};
9
10class ErrorInfo
11{
12 int errorCode;
13 std::string keyword;
14 std::string sourceFilePath;
15 int sourceLineNum;
16 int errorLineNum;
17
18public:
19 ErrorInfo( int errorCode, const std::string &keyword, const std::string &sourceFilePath, int sourceLineNum )
20 : errorCode( errorCode )
21 , keyword( keyword )
22 , sourceFilePath( sourceFilePath )
23 , sourceLineNum( sourceLineNum )
24 {
25 }
26 ErrorInfo( int errorCode, const std::string &keyword, int sourceIndex );
27
28 int GetErrorCode() const
29 {
30 return errorCode;
31 }
32 bool IsWarning() const
33 {
34 return ( errorCode < -100 );
35 }
36 const std::string &GetKeyword() const
37 {
38 return keyword;
39 }
40 const std::string &GetSourceFilePath() const
41 {
42 return sourceFilePath;
43 }
44 int GetSourceLineNum() const
45 {
46 return sourceLineNum;
47 }
48 int GetErrorLineNum() const
49 {
50 return errorLineNum;
51 }
52
53 std::string GetMessageString() const;
54 std::string GetFullMessageString() const;
55};
56typedef std::vector<ErrorInfo> ErrorInfos;
57
58class ErrorMessenger
59 : public Messenger
60{
61 ErrorInfos errorInfos;
62 Jenga::Common::Strings synonymKeyWords;
63
64public:
65 void Output( const ErrorInfo &errorInfo );
66 void Output( int errorCode, const std::string &keyword, int sourceIndex = -1 );
67 void Output( int errorCode, const char *keyword, int sourceIndex = -1 );
68 void OutputFatalError();
69
70 void ClearSynonymKeyWords();
71
72 int GetErrorCount() const;
73 bool HasError() const;
74 int GetWarningCount() const;
75
76 void ShowErrorLine( int errorLineNum );
77};
Note: See TracBrowser for help on using the repository browser.