01: package gnu.expr;
02:
03: import gnu.mapping.*;
04:
05: /**
06: * Class used to mark an erroneous expression
07: * @author Per Bothner
08: */
09:
10: public class ErrorExp extends Expression {
11: String message;
12:
13: public ErrorExp(String message) {
14: this .message = message;
15: }
16:
17: public Object eval(Environment env) {
18: // Should not happen
19: throw new RuntimeException("evaluated erroneous expression: "
20: + message);
21: }
22:
23: public void print(OutPort out) {
24: out.startLogicalBlock("(Error", false, ")");
25: out.writeSpaceLinear();
26: out.print(message);
27: out.endLogicalBlock(")");
28: }
29:
30: public void compile(Compilation comp, Target target) {
31: // Should never happen!
32: }
33: }
|