/src/org/ooc/frontend/model/StringLiteral.java

http://github.com/nddrylliog/ooc · Java · 48 lines · 35 code · 13 blank · 0 comment · 0 complexity · 689007dff5646930b80b07447b24cef4 MD5 · raw file

  1. package org.ooc.frontend.model;
  2. import java.io.IOException;
  3. import org.ooc.frontend.Visitor;
  4. import org.ooc.frontend.model.tokens.Token;
  5. public class StringLiteral extends Literal {
  6. protected String value;
  7. public static Type type = new Type("String", Token.defaultToken);
  8. public StringLiteral(String value, Token startToken) {
  9. super(startToken);
  10. this.value = value;
  11. }
  12. public Type getType() {
  13. return type;
  14. }
  15. public String getValue() {
  16. return value;
  17. }
  18. public void accept(Visitor visitor) throws IOException {
  19. visitor.visit(this);
  20. }
  21. public boolean hasChildren() {
  22. return true;
  23. }
  24. public void acceptChildren(Visitor visitor) throws IOException {
  25. type.accept(visitor);
  26. }
  27. @Override
  28. public boolean replace(Node oldie, Node kiddo) {
  29. return false;
  30. }
  31. @Override
  32. public String toString() {
  33. return "\""+value+"\"";
  34. }
  35. }