org.snapscript.tree.literal.TextLiteral Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree.literal;
import static org.snapscript.core.constraint.Constraint.STRING;
import org.snapscript.core.InternalStateException;
import org.snapscript.core.scope.Scope;
import org.snapscript.parse.StringToken;
public class TextLiteral extends Literal {
private final StringToken token;
public TextLiteral(StringToken token) {
this.token = token;
}
@Override
protected LiteralValue create(Scope scope) throws Exception {
String text = token.getValue();
if(text == null) {
throw new InternalStateException("Text value was null");
}
return new LiteralValue(text, STRING);
}
}