예제 #1
0
파일: Block.java 프로젝트: nathsou/Giraffe
  public Variable getVariable(String name) throws SyntaxException {

    Block block = this;

    while (block != null) {
      for (Variable var : block.getVariables()) {
        if (var.getName().equals(name)) return var;
      }

      block = block.getParent();
    }

    throw new SyntaxException("No variable named '" + name + "'.");
  }
예제 #2
0
파일: Block.java 프로젝트: nathsou/Giraffe
  public Boolean variableExists(String name) {

    Block block = this;

    while (block.getParent() != null) {
      for (Variable var : block.getVariables()) {
        if (var.getName().equals(name)) return true;
      }

      block = block.getParent();
    }

    return false;
  }