Source code: marf/nlp/Parsing/CompilerError.java
1 /*
2 * CompilerError Class.
3 * (C) 2001-2005 Serguei Mokhov, <mailto:mokhov@cs.concordia.ca>
4 */
5
6 package marf.nlp.Parsing;
7
8 import java.io.Serializable;
9
10 import marf.nlp.NLPException;
11
12
13 /**
14 * <p>Generic Compiler Error.
15 * Normally subclassed to differentiate
16 * between various error types like
17 * lexical, syntactical, semantic and such.</p>
18 *
19 * $Id: CompilerError.java,v 1.12 2005/08/13 23:09:39 susan_fan Exp $
20 *
21 * @author Serguei Mokhov
22 * @version $Revision: 1.12 $
23 * @since 0.3.0.2
24 */
25 public class CompilerError
26 extends NLPException
27 implements Serializable
28 {
29 /**
30 * For serialization versioning.
31 * When adding new members or make other structural
32 * changes regenerate this number with the
33 * <code>serialver</code> tool that comes with JDK.
34 * @since 0.3.0.4
35 */
36 private static final long serialVersionUID = -6425511198047596019L;
37
38 /**
39 * Error code signifying "no error".
40 * @since October 2, 2001
41 */
42 public static final int OK = 0;
43
44 /**
45 * Error code of the last error occured.
46 * @since October 2, 2001
47 */
48 protected int CurrentErrorCode = OK;
49
50 /**
51 * A descriptive message correspoding to a given error code.
52 * @since October 2, 2001
53 */
54 protected String CurrentErrorString = "";
55
56 /**
57 * Line number where the given error occurred.
58 * @since October 2, 2001
59 */
60 protected int LineNo = -1;
61
62 /**
63 * Default Constructor.
64 * @since October 2, 2001
65 */
66 public CompilerError()
67 {
68 super("CompilerError");
69 }
70
71 /**
72 * @param poException
73 */
74 public CompilerError(Exception poException)
75 {
76 super(poException);
77 }
78
79 /**
80 * @param pstrMessage
81 */
82 public CompilerError(String pstrMessage)
83 {
84 super(pstrMessage);
85 }
86
87 /**
88 * @param pstrMessage
89 * @param poException
90 */
91 public CompilerError(String pstrMessage, Exception poException)
92 {
93 super(pstrMessage, poException);
94 }
95
96 /**
97 * Access method for the CurrentErrorCode property.
98 *
99 * @return the current value of the CurrentErrorCode property
100 */
101 public int getCurrentErrorCode()
102 {
103 return CurrentErrorCode;
104 }
105
106 /**
107 * Access method for the CurrentErrorString property.
108 *
109 * @return the current value of the CurrentErrorString property
110 */
111 public String getCurrentErrorString()
112 {
113 return CurrentErrorString;
114 }
115
116 /**
117 * Access method for the LineNo property.
118 *
119 * @return the current value of the LineNo property
120 */
121 public int getLineNo()
122 {
123 return LineNo;
124 }
125
126 /**
127 * Retrieves class' revision.
128 * @return revision string
129 */
130 public static String getMARFSourceCodeRevision()
131 {
132 return "$Revision: 1.12 $";
133 }
134 }