SUM OPENPAREN ID:set DOT ID:relation CLOSEPAREN
{:
debugMessage(PRODSTRING);
- ParseNode expr = new ParseNode("sumexpr", parser.curLine(3));
- expr.addChild("dot").addChild("set", parser.curLine(3)).addChild(set);
- expr.getChild("dot").addChild("relation", parser.curLine(1)).addChild(relation);
+ ParseNode expr = new ParseNode("expr", parser.curLine(1));
+ expr.addChild("sumexpr", parser.curLine(3));
+ expr.getChild("sumexpr").addChild("dot").addChild("set", parser.curLine(3)).addChild(set);
+ expr.getChild("sumexpr").getChild("dot").addChild("relation", parser.curLine(1)).addChild(relation);
RESULT = expr;
:}
if (!precheck(pn, "sumexpr")) {
return null;
}
- String setname = pn.getChild("set").getTerminal();
+ String setname = pn.getChild("dot").getChild("set").getTerminal();
assert setname != null;
SetDescriptor sd = lookupSet(setname);
}
public String name() {
- return "sum("+sd.getSafeSymbol()+"."+rd.getSafeSymbol()+")";
+ return "sum("+sd.toString()+"."+rd.toString()+")";
}
public boolean equals(Map remap, Expr e) {
}
public Descriptor getDescriptor() {
- throw new Error();
+ throw new Error("Sum shouldn't appear on left hand side!");
}
public boolean inverted() {
public void prettyPrint(PrettyPrinter pp) {
pp.output("sum(");
- pp.output(sd.getSafeSymbol());
+ pp.output(sd.toString());
pp.output(".");
- pp.output(rd.getSafeSymbol());
+ pp.output(rd.toString());
pp.output(")");
}