| 1 |
/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */ |
| 2 |
/* JavaCCOptions:STATIC=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ |
| 3 |
#ifndef ERRORHANDLER_H |
| 4 |
#define ERRORHANDLER_H |
| 5 |
#include <string> |
| 6 |
#include "JavaCC.h" |
| 7 |
#include "Token.h" |
| 8 |
|
| 9 |
namespace Konclude { |
| 10 |
namespace Parser { |
| 11 |
namespace FunctionalJAVACC { |
| 12 |
class OWL2FunctionalStyleParser; |
| 13 |
class ErrorHandler { |
| 14 |
protected: |
| 15 |
int error_count; |
| 16 |
public: |
| 17 |
// Called when the parser encounters a different token when expecting to |
| 18 |
// consume a specific kind of token. |
| 19 |
// expectedKind - token kind that the parser was trying to consume. |
| 20 |
// expectedToken - the image of the token - tokenImages[expectedKind]. |
| 21 |
// actual - the actual token that the parser got instead. |
| 22 |
virtual void handleUnexpectedToken(int expectedKind, JAVACC_STRING_TYPE expectedToken, Token *actual, OWL2FunctionalStyleParser *parser) { |
| 23 |
error_count++; |
| 24 |
fprintf(stderr, "Expecting %s at: %d:%d but got %s\n", addUnicodeEscapes(expectedToken).c_str(), actual->beginLine, actual->beginColumn, addUnicodeEscapes(actual->image).c_str()); |
| 25 |
} |
| 26 |
// Called when the parser cannot continue parsing. |
| 27 |
// last - the last token successfully parsed. |
| 28 |
// unexpected - the token at which the error occurs. |
| 29 |
// production - the production in which this error occurrs. |
| 30 |
virtual void handleParseError(Token *last, Token *unexpected, JAVACC_SIMPLE_STRING production, OWL2FunctionalStyleParser *parser) { |
| 31 |
error_count++; |
| 32 |
fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str()); |
| 33 |
} |
| 34 |
virtual int getErrorCount() { |
| 35 |
return error_count; |
| 36 |
} |
| 37 |
virtual ~ErrorHandler() {} |
| 38 |
ErrorHandler() { error_count = 0; } |
| 39 |
}; |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
#endif |
| 45 |
/* JavaCC - OriginalChecksum=0a367742c4600a1642742497f80bb97a (do not edit this line) */ |