01: package gnu.expr;
02:
03: import gnu.mapping.*;
04: import gnu.text.SourceMessages;
05:
06: /**
07: * Class used to mark an erroneous expression
08: * @author Per Bothner
09: */
10:
11: public class ErrorExp extends Expression {
12: String message;
13:
14: public ErrorExp(String message) {
15: this .message = message;
16: }
17:
18: public ErrorExp(String message, SourceMessages messages) {
19: messages.error('e', message);
20: this .message = message;
21: }
22:
23: public ErrorExp(String message, Compilation comp) {
24: comp.getMessages().error('e', message);
25: this .message = message;
26: }
27:
28: protected boolean mustCompile() {
29: return false;
30: }
31:
32: public void print(OutPort out) {
33: out.startLogicalBlock("(Error", false, ")");
34: out.writeSpaceLinear();
35: out.print(message);
36: out.endLogicalBlock(")");
37: }
38:
39: public void compile(Compilation comp, Target target) {
40: // Should never happen!
41: throw new Error(comp.getFileName() + ":" + comp.getLineNumber()
42: + ": internal error: compiling error expression: "
43: + message);
44: }
45: }
|