package me.tomassetti.turin.parser.ast.expressions.literals;
import com.google.common.collect.ImmutableList;
import me.tomassetti.turin.parser.ast.Node;
import me.tomassetti.turin.parser.ast.expressions.Expression;
import me.tomassetti.turin.typesystem.ReferenceTypeUsage;
import me.tomassetti.turin.typesystem.TypeUsage;
public class StringLiteral extends Expression {
private String value;
public StringLiteral(String value) {
this.value = value;
}
@Override
public String toString() {
return "StringLiteral{" +
"value='" + value + '\'' +
'}';
}
public String getValue() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StringLiteral that = (StringLiteral) o;
if (!value.equals(that.value)) return false;
return true;
}
@Override
public int hashCode() {
return value.hashCode();
}
@Override
public Iterable<Node> getChildren() {
return ImmutableList.of();
}
@Override
public TypeUsage calcType() {
return ReferenceTypeUsage.STRING(symbolResolver());
}
}