/src/org/ooc/frontend/model/StringLiteral.java
Java | 48 lines | 35 code | 13 blank | 0 comment | 0 complexity | 689007dff5646930b80b07447b24cef4 MD5 | raw file
1package org.ooc.frontend.model; 2 3import java.io.IOException; 4 5import org.ooc.frontend.Visitor; 6import org.ooc.frontend.model.tokens.Token; 7 8public class StringLiteral extends Literal { 9 10 protected String value; 11 public static Type type = new Type("String", Token.defaultToken); 12 13 public StringLiteral(String value, Token startToken) { 14 super(startToken); 15 this.value = value; 16 } 17 18 public Type getType() { 19 return type; 20 } 21 22 public String getValue() { 23 return value; 24 } 25 26 public void accept(Visitor visitor) throws IOException { 27 visitor.visit(this); 28 } 29 30 public boolean hasChildren() { 31 return true; 32 } 33 34 public void acceptChildren(Visitor visitor) throws IOException { 35 type.accept(visitor); 36 } 37 38 @Override 39 public boolean replace(Node oldie, Node kiddo) { 40 return false; 41 } 42 43 @Override 44 public String toString() { 45 return "\""+value+"\""; 46 } 47 48}