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

http://github.com/nddrylliog/ooc · Java · 53 lines · 38 code · 15 blank · 0 comment · 0 complexity · 3aa24972ba7c6bc2a191835dfb487ef9 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 Block extends Statement implements Scope {
  6. protected final NodeList<Line> body;
  7. public Block(Token startToken) {
  8. super(startToken);
  9. body = new NodeList<Line>(startToken);
  10. }
  11. public void accept(Visitor visitor) throws IOException {
  12. visitor.visit(this);
  13. }
  14. public void acceptChildren(Visitor visitor) throws IOException {
  15. body.accept(visitor);
  16. }
  17. public boolean hasChildren() {
  18. return body.hasChildren();
  19. }
  20. @Override
  21. public boolean replace(Node oldie, Node kiddo) {
  22. return false;
  23. }
  24. public NodeList<Line> getBody() {
  25. return body;
  26. }
  27. public FunctionDecl getFunction(String name, String suffix,
  28. FunctionCall call) {
  29. return null;
  30. }
  31. public void getFunctions(NodeList<FunctionDecl> functions) {}
  32. public VariableDecl getVariable(String name) {
  33. return getVariable(body, name);
  34. }
  35. public void getVariables(NodeList<VariableDecl> variables) {
  36. getVariables(body, variables);
  37. }
  38. }