Ejemplo n.º 1
0
std::string CallNode::AsString()
{
  std::string paramString;
  for (auto it = params.begin();
       it < std::prev(params.end());
       it++)
  {
    ASTNode* param = *it;
    paramString += FormatString("(%s), ", param->AsString().c_str());
  }
  paramString += FormatString("(%s)", params.back()->AsString().c_str());

  if (isResolved)
  {
    if (resolvedFunction->type == CodeThing::Type::FUNCTION)
    {
      return FormatString("Call(R) (%s) {%s}", dynamic_cast<FunctionThing*>(resolvedFunction)->name.c_str(), paramString.c_str());
    }
    else
    {
      return FormatString("Call(R) (%s) {%s}", GetTokenName(dynamic_cast<OperatorThing*>(resolvedFunction)->token), paramString.c_str());
    }
  }
  else
  {
    return FormatString("Call(UR) (%s) {%s}", name, paramString.c_str());
  }
}
Ejemplo n.º 2
0
std::string ArrayInitNode::AsString()
{
  std::string itemString;
  for (auto it = items.begin();
       it < std::prev(items.end());
       it++)
  {
    ASTNode* item = *it;
    itemString += FormatString("(%s), ", item->AsString().c_str());
  }
  itemString += FormatString("(%s)", items.back()->AsString().c_str());
  return itemString;
}
Ejemplo n.º 3
0
std::string ConstructNode::AsString()
{
  std::string str;
  str += FormatString("Construct(%s)(", typeName.c_str());

  for (auto it = items.begin();
       it < std::prev(items.end());
       it++)
  {
    ASTNode* item = *it;
    str += FormatString("(%s), ", item->AsString().c_str());
  }
  str += FormatString("(%s))", items.back()->AsString().c_str());
  return str;
}