package io.gitlab.jfronny.muscript.ast.literal; import io.gitlab.jfronny.muscript.ast.StringExpr; import io.gitlab.jfronny.muscript.compiler.ExprWriter; import io.gitlab.jfronny.muscript.compiler.Order; import io.gitlab.jfronny.muscript.data.Scope; import java.io.IOException; public final class StringLiteral extends StringExpr { public final String value; public StringLiteral(int chStart, int chEnd, String value) { super(Order.Primary, chStart, chEnd); this.value = value; } @Override public String get(Scope dataRoot) { return value; } @Override public StringExpr optimize() { return this; } @Override public void decompile(ExprWriter writer) throws IOException { writer.append(enquote(value)); } @Override public boolean equals(Object obj) { return obj instanceof StringLiteral literal && value.equals(literal.value); } }