- /* get comparison operator */
- String compareop = sizeof.getChild("compare").getTerminal();
- Opcode opcode = Opcode.decodeFromString(compareop);
-
- if (opcode == null) {
- er.report(pn, "Unsupported operation '" + compareop + "'");
- return null;
- } else if (opcode != Opcode.EQ &&
- opcode != Opcode.GE &&
- opcode != Opcode.LE) {
- er.report(pn, "Invalid operation '" + compareop + "': Must be one of '=', '>=', '<='");
- return null;
- }
-
- /* get decimal */
- String decimal = sizeof.getChild("decimal").getTerminal();
- IntegerLiteralExpr cardinality = new IntegerLiteralExpr(Integer.parseInt(decimal));
-
- return new SizeofPredicate(setexpr, opcode, cardinality);
- } else if (pn.getChild("comparison") != null) {
- ParseNode cn = pn.getChild("comparison");
-
- /* get quantifier variable */
- String varname = cn.getChild("quantifier").getTerminal();
- String relation = cn.getChild("relation").getTerminal();
-
- if (!sts.peek().contains(varname)) {
- er.report(pn, "Undefined quantifier '" + varname + "'");
- return null;
- }
-
- VarDescriptor vd = (VarDescriptor) sts.peek().get(varname);
-
- if (!stRelations.contains(relation)) {
- er.report(pn, "Undefined relation '" + varname + "'");
- return null;
- }
-
- RelationDescriptor rd = (RelationDescriptor) stRelations.get(relation);
-
- /* get the expr's */
- Expr expr = parse_expr(cn.getChild("expr"));
+ return new InclusionPredicate(expr, setexpr);
+ } else if (pn.getChild("expr") != null) {
+ Expr expr = parse_expr(pn.getChild("expr"));