All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.tree.literal.TextLiteral Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.tree.literal;

import static org.snapscript.core.variable.Constant.STRING;

import org.snapscript.core.error.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);
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy