preambles.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _PREAMBLES_H_
00012 #define _PREAMBLES_H_
00013
00014 #include <string>
00015 #include "problemreporter.h"
00016
00017 #define ANTLR_PARSER_PREAMBLE \
00018 private: \
00019 unsigned int m_numberOfErrors; \
00020 ProblemReporter* m_problemReporter; \
00021 \
00022 public: \
00023 void resetErrors () { m_numberOfErrors = 0; } \
00024 unsigned int numberOfErrors () const { return m_numberOfErrors; } \
00025 void setProblemReporter (ProblemReporter* r) { m_problemReporter = r; } \
00026 \
00027 void reportError (const antlr::RecognitionException& ex) { \
00028 m_problemReporter->reportError \
00029 (ex.toString().c_str (), \
00030 ex.getFilename().c_str (), \
00031 ex.getLine (), \
00032 ex.getColumn ()); \
00033 ++m_numberOfErrors; \
00034 } \
00035 \
00036 void reportError (const std::string& errorMessage) { \
00037 m_problemReporter->reportError \
00038 (errorMessage.c_str(), \
00039 getFilename ().c_str(), \
00040 LT(1)->getLine (), \
00041 LT(1)->getColumn ()); \
00042 ++m_numberOfErrors; \
00043 } \
00044 \
00045 void reportMessage (const std::string& message) { \
00046 m_problemReporter->reportMessage \
00047 (message.c_str (), \
00048 getFilename ().c_str (), \
00049 LT(1)->getLine (), \
00050 LT(1)->getColumn ()); \
00051 }
00052
00053 #define ANTLR_LEXER_PREAMBLE \
00054 private: \
00055 unsigned int m_numberOfErrors; \
00056 ProblemReporter* m_problemReporter; \
00057 \
00058 public: \
00059 void resetErrors () { m_numberOfErrors = 0; } \
00060 unsigned int numberOfErrors () const { return m_numberOfErrors; } \
00061 void setProblemReporter (ProblemReporter* r) { m_problemReporter = r; } \
00062 \
00063 void reportError (const antlr::RecognitionException& ex) { \
00064 m_problemReporter->reportError \
00065 (ex.toString ().c_str (), \
00066 ex.getFilename ().c_str (), \
00067 ex.getLine (), \
00068 ex.getColumn ()); \
00069 ++m_numberOfErrors; \
00070 } \
00071 \
00072 void reportError (const std::string& errorMessage) { \
00073 m_problemReporter->reportError \
00074 (errorMessage.c_str (), \
00075 getFilename().c_str (), \
00076 getLine (), \
00077 getColumn ()); \
00078 ++m_numberOfErrors; \
00079 } \
00080 \
00081 void reportWarning (const std::string& warnMessage) { \
00082 m_problemReporter->reportWarning \
00083 (warnMessage.c_str (), \
00084 getFilename ().c_str (), \
00085 getLine (), \
00086 getColumn ()); \
00087 }
00088
00089 #endif // _PREAMBLES_H_
00090
This file is part of the documentation for KDevelop Version 3.1.2.