/** Our internal representation of a Paren * in the B0 language. * See http://www.radford.edu/itec380/2022fall-ibarland/Homeworks/Project/ * * @author Ian Barland * @version 2022.Apr.04 */ public record NoOp(Expr e) implements Expr { static final String START_TOKEN = "force"; static final String STOP_TOKEN = ""; public String toString(/* Paren this */) { return START_TOKEN + " " + this.e.toString() + STOP_TOKEN ; } public static NoOp parse( java.util.Scanner s, String punctuation ) { UtilIan.verifyToken( UtilIan.nextSplittingBy(s,punctuation), START_TOKEN); // Consume the opening paren, and continue. // NOTE: recur with `Expr.parse` -- not `parse` = `Paren.parse` which is NOT what we want! Expr theInsideExpr = Expr.parse(s,punctuation); // no STOP_TOKEN to read return new NoOp(theInsideExpr); } public Value eval() { return this.e.eval(); } }