Skip to content

Commit

Permalink
Parse XSTS with clocks in right op of relation exprs
Browse files Browse the repository at this point in the history
  • Loading branch information
DoriCz committed Dec 18, 2023
1 parent c790656 commit 79ecd0d
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,12 @@ public Expr<?> visitRelationExpr(final RelationExprContext ctx) {
if (ctx.rightOp != null) {
final Expr<?> leftOp = ctx.leftOp.accept(this);
final Expr<?> rightOp = ctx.rightOp.accept(this);
final int operType = ctx.oper.getType();

if (leftOp.getType() instanceof ClockType) {
final Expr<ClockType> clock = cast(leftOp, Clock());
final Expr<IntType> value = cast(rightOp, Int());
switch (ctx.oper.getType()) {
switch (operType) {
case LT:
return ClockExprs.Lt(clock, value);
case LEQ:
Expand All @@ -258,14 +259,28 @@ public Expr<?> visitRelationExpr(final RelationExprContext ctx) {
return ClockExprs.Gt(clock, value);
case GEQ:
return ClockExprs.Geq(clock, value);
case EQ:
return ClockExprs.Eq(clock, value);
default:
throw new ParseException(ctx, "Unknown operator");
}
}
if (rightOp.getType() instanceof ClockType) {
final Expr<IntType> value = cast(leftOp, Int());
final Expr<ClockType> clock = cast(rightOp, Clock());
switch (operType) {
case LT:
return ClockExprs.Gt(clock, value);
case LEQ:
return ClockExprs.Geq(clock, value);
case GT:
return ClockExprs.Lt(clock, value);
case GEQ:
return ClockExprs.Leq(clock, value);
default:
throw new ParseException(ctx, "Unknown operator");
}
}

switch (ctx.oper.getType()) {
switch (operType) {
case LT:
return Lt(leftOp, rightOp);
case LEQ:
Expand Down

0 comments on commit 79ecd0d

Please sign in to comment.