예제 #1
0
symbol* find_typeTable (const string* key) {
  auto found = typeTable.find(key);
  if (found == typeTable.end()){
    return NULL;
  } else {
    return found->second;
  }
}
예제 #2
0
symbol* grabStructSymbol (const string* ident)
{
  auto table_check = typeTable.find(ident);
  if(table_check != typeTable.end())
    {
      return table_check->second;
    }
  fprintf(stderr, "oc: %s struct does not exist\n", ident->c_str());
  return NULL;
}
예제 #3
0
/** Traverse block and find name of symbol */
static string traverse_block_two(symbol_table mymap,string tname){
  // find in map
  symbol_table::iterator got = mymap.find (&tname);

  // if symbool found, return symbol
  if ( got != mymap.end() ) {
    string type = *(got->first);
    return type;
  }

  // otherwise, keep traversing
  return traverse_block_two(*got->second->fields,tname);
}