1 /* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */
2 /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,BUILD_PARSER=true,BUILD_TOKEN_MANAGER=true */
12 //JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str);
16 friend class VhdlParserTokenManager;
17 friend class VhdlParser;
21 // Called when the parser encounters a different token when expecting to
22 // consume a specific kind of token.
23 // expectedKind - token kind that the parser was trying to consume.
24 // expectedToken - the image of the token - tokenImages[expectedKind].
25 // actual - the actual token that the parser got instead.
26 virtual void handleUnexpectedToken(int , JAVACC_STRING_TYPE , Token *, VhdlParser *) {
28 // fprintf(stderr, "Expecting %s at: %d:%d but got %s\n", addUnicodeEscapes(expectedToken).c_str(), actual->beginLine, actual->beginColumn, addUnicodeEscapes(actual->image).c_str());
30 // Called when the parser cannot continue parsing.
31 // last - the last token successfully parsed.
32 // unexpected - the token at which the error occurs.
33 // production - the production in which this error occurrs.
34 virtual void handleParseError(Token *, Token *, JAVACC_SIMPLE_STRING , VhdlParser *) {
36 // fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str());
38 virtual int getErrorCount() {
41 virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *) {
42 fprintf(stderr, "Error: %s\n", (char*)message.c_str());
44 virtual ~ErrorHandler() {}
45 ErrorHandler() { error_count = 0; }
48 class VhdlParserTokenManager;
49 class TokenManagerErrorHandler {
50 friend class VhdlParserTokenManager;
54 // Returns a detailed message for the Error when it is thrown by the
55 // token manager to indicate a lexical error.
57 // EOFSeen : indicates if EOF caused the lexical error
58 // curLexState : lexical state in which this error occurred
59 // errorLine : line number when the error occurred
60 // errorColumn : column number when the error occurred
61 // errorAfter : prefix that was seen before this error occurred
62 // curchar : the offending character
64 virtual void lexicalError(bool EOFSeen, int /*lexState*/, int errorLine, int errorColumn, JAVACC_STRING_TYPE errorAfter, JAVACC_CHAR_TYPE curChar, VhdlParserTokenManager*) {
65 // by default, we just print an error message and return.
66 fprintf(stderr, "Lexical error at: %d:%d. Encountered: %c after: %s.\n", errorLine, errorColumn, curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str()));
68 virtual void lexicalError(JAVACC_STRING_TYPE errorMessage, VhdlParserTokenManager* ) {
69 fprintf(stderr, "%s\n", (char*)errorMessage.c_str());
71 virtual ~TokenManagerErrorHandler() {}
78 /* JavaCC - OriginalChecksum=685d19cb4cd943b60089f599e45f23ad (do not edit this line) */