summaryrefslogtreecommitdiffstats
path: root/vhdlparser/TokenMgrError.h
blob: 90c7530ae927f0de2e8bcb975b34a52c28f8a418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.h Version 7.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef JAVACC_TOKENMGRERROR_H
#define JAVACC_TOKENMGRERROR_H

#include "JavaCC.h"


namespace vhdl {
namespace parser {

enum LexerErrors {
  /**
   * Lexical error occurred.
   */
  LEXICAL_ERROR = 0,

  /**
   * An attempt was made to create a second instance of a  token manager.
   */
  STATIC_LEXER_ERROR = 1,

  /**
   * Tried to change to an invalid lexical state.
   */
  INVALID_LEXICAL_STATE = 2,

  /**
   * Detected (and bailed out of) an infinite loop in the token manager.
   */
  LOOP_DETECTED = 3,
};

class TokenMgrError {
public:
  /*
   * Ordinals for various reasons why an Error of this type can be thrown.
   */

  /**
   * Indicates the reason why the exception is thrown. It will have
   * one of the above 4 values.
   */
  int errorCode;

  /**
   * Returns a detailed message for the Error when it is thrown by the
   * token manager to indicate a lexical error.
   * Parameters :
   *    EOFSeen     : indicates if EOF caused the lexical error
   *    curLexState : lexical state in which this error occurred
   *    errorLine   : line number when the error occurred
   *    errorColumn : column number when the error occurred
   *    errorAfter  : prefix that was seen before this error occurred
   *    curchar     : the offending character
   * Note: You can customize the lexical error message by modifying this method.
   */
    JJString LexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, const JJString& errorAfter, JJChar curChar);

private:
   JJString message;

  /**
   * You can also modify the body of this method to customize your error messages.
   * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
   * of end-users concern, so you can return something like :
   *
   *     "Internal Error : Please file a bug report .... "
   *
   * from this method for such cases in the release version of your parser.
   */
public:
  JJString getMessage() ;

  /*
   * Constructors of various flavors follow.
   */

  /** No arg constructor. */
  TokenMgrError() ;

  /** Constructor with message and reason. */
  TokenMgrError(const JJString& message, int reason) ;

  /** Full Constructor. */
  TokenMgrError(bool EOFSeen, int lexState, int errorLine, int errorColumn, const JJString& errorAfter, JJChar curChar, int reason) ;
};

}
}

#endif
/* JavaCC - OriginalChecksum=4ab4cdcdef6a3feec22fd9c00ba86e07 (do not edit this line) */