cminus/submit/ast/UnaryOperator.java

28 lines
551 B
Java

/*
* Code formatter project
* CS 4481
*/
package submit.ast;
/**
*
* @author edwajohn
*/
public class UnaryOperator extends AbstractNode implements Expression {
private final UnaryOperatorType type;
private final Expression expression;
public UnaryOperator(String type, Expression expression) {
this.type = UnaryOperatorType.fromString(type);
this.expression = expression;
}
@Override
public void toCminus(StringBuilder builder, String prefix) {
builder.append(type);
expression.toCminus(builder, prefix);
}
}