コード例 #1
0
ファイル: StreeEQ.java プロジェクト: zlatan-ibrahimovic/SE
  // ne traite pas les boolean
  public StreeEQ(Stree left, Stree right, Env currentEnv) throws TypeException {
    super(EnumTag.EQ, left, right, null);
    this.currentEnv = currentEnv;

    if (isIntegerOrFloat(left) || isBoolean(left)) {
      this.left.type = left.getEnumType();
    } else {
      if (currentEnv.find(String.valueOf(left.getObject())) == null) {
        throw new TypeException("variable [" + left.getObject() + "] not declared  ");
      } else {
        this.left.type = currentEnv.find(String.valueOf(left.getObject())).getEnumType();
      }
    }

    if (isIntegerOrFloat(right) || isBoolean(right)) {
      this.right.type = right.getEnumType();
    } else {
      if (currentEnv.find(String.valueOf(right.getObject())) == null) {
        throw new TypeException("variable [" + right.getObject() + "] not declared  ");
      } else {
        this.right.type = currentEnv.find(String.valueOf(right.getObject())).getEnumType();
      }
    }
  }
コード例 #2
0
ファイル: ITree.java プロジェクト: zlatan-ibrahimovic/SE
 public static ITree toITree(Stree stree) throws TypeException {
   return stree.toITree();
 }