Exemplo n.º 1
0
void
operativeMachine::addAttrInNode (void)
{
  /* NOTE : constant nodes and expression nodes (unary, binary, 
     ternary, reference, others) haven't any attributes
  */

  nast_code 
    code = c_nnp->getCode ();    // The code of the nast_node


  // What node class belong to ?

  // declaration nodes
  if (isDecl (code) || isOthrDecl (code))
    addAttrInDecl ();

  // type nodes
  else if (isType (code) || isOthrType (code))
    addAttrInType ();

  // statement nodes
  else if (isStmt (code) || isOthrStmt (code))
    addAttrInStmt ();

  // other nodes
  else if (isOthr (code))
    addAttrInOthr ();

  else
    printWarning ("operativeMachine",
		  "The attribute doesn't belong to any node");

  return;
}
Exemplo n.º 2
0
long 
stmtNumData::numStmt(nast_code code)
  throw (bad_data)
{ 
  if ( (isStmt(code)) || (isOthrStmt(code)) || (code == CASE_LABEL) )
    return counted[code]; 
  else 
    throw bad_data("stmtNumData",
		   "Impossibile get the number of a stmt_n");
}
Exemplo n.º 3
0
// ---------------------------------------------------------------------------
//  CLASS
// ---------------------------------------------------------------------------
void 
stmtNumData::addStmt(nast_code code)
  throw (bad_data)
{ 
  if ( (isStmt(code)) || (isOthrStmt(code)) || (code == CASE_LABEL) )
    counted[code]++; 
  else 
    throw bad_data("stmtNumData",
		   "Impossibile add a new stmt_n");
  return;
}
Exemplo n.º 4
0
bool Expr::isStmtExpr() const {
  bool retval = false;

  if (isStmt() == true) {
    retval = true;

  // NOAKES 2014/11/28 A WhileStmt is currently a BlockStmt
  // but needs special handling
  } else if (WhileStmt* parent = toWhileStmt(parentExpr)) {
    retval = (parent->condExprGet() != this) ? true : false;

  // NOAKES 2014/11/30 A ForLoop is currently a BlockStmt
  // but needs special handling
  } else if (ForLoop* parent = toForLoop(parentExpr)) {
    retval = (parent->indexGet() != this && parent->iteratorGet() != this) ? true : false;

  } else {
    retval = isDirectlyUnderBlockStmt(this);
  }

  return retval;
}