1999-04-27 16:22:20 +00:00
|
|
|
class RelationalNode extends BinaryNode {
|
|
|
|
|
|
|
|
RelationalNode(String aOp, ExpressionNode aLeft, ExpressionNode aRight)
|
|
|
|
{
|
|
|
|
super(aOp, aLeft, aRight);
|
|
|
|
}
|
1999-05-07 22:07:22 +00:00
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue eval(Environment theEnv)
|
1999-05-07 22:07:22 +00:00
|
|
|
{
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue lV = left.eval(theEnv);
|
|
|
|
JSValue rV = right.eval(theEnv);
|
1999-05-20 21:16:11 +00:00
|
|
|
|
1999-05-07 22:07:22 +00:00
|
|
|
if (op == ">")
|
1999-05-28 19:00:48 +00:00
|
|
|
return lV.gt(theEnv, rV);
|
1999-05-07 22:07:22 +00:00
|
|
|
else
|
|
|
|
if (op == ">=")
|
1999-05-28 19:00:48 +00:00
|
|
|
return lV.ge(theEnv, rV);
|
1999-05-07 22:07:22 +00:00
|
|
|
else
|
|
|
|
if (op == "<")
|
1999-05-28 19:00:48 +00:00
|
|
|
return lV.lt(theEnv, rV);
|
1999-05-07 22:07:22 +00:00
|
|
|
else
|
|
|
|
if (op == "<=")
|
1999-05-28 19:00:48 +00:00
|
|
|
return lV.le(theEnv, rV);
|
1999-05-07 22:07:22 +00:00
|
|
|
else
|
|
|
|
if (op == "==")
|
1999-05-28 19:00:48 +00:00
|
|
|
return lV.eq(theEnv, rV);
|
1999-05-07 22:07:22 +00:00
|
|
|
else
|
|
|
|
if (op == "!=")
|
1999-05-28 19:00:48 +00:00
|
|
|
return lV.ne(theEnv, rV);
|
|
|
|
else {
|
1999-05-07 22:07:22 +00:00
|
|
|
System.out.println("missing relational op");
|
1999-05-28 19:00:48 +00:00
|
|
|
return null;
|
|
|
|
}
|
1999-05-07 22:07:22 +00:00
|
|
|
}
|
1999-04-27 16:22:20 +00:00
|
|
|
}
|