Exemple #1
0
std::string FunctionCall::ToString( const PrintingContext& pctx ) const
{
    std::string tabs = pctx.Tabs();
    std::string str;
    
    if( !pctx.inlineWriting )
        str += tabs;
    
    str += myCalledFunction->GetName() + "( ";
    
    if( mySubOps.size() > 0 )
    {
        for( size_t i = 0; i < mySubOps.size()-1; i++ )
            str += mySubOps[i]->ToString( pctx.InlineWriting() ) + ", ";
        
        str += mySubOps[ mySubOps.size() - 1 ]->ToString( pctx.InlineWriting() );
    }
    
    str += " )";
    
    if( !pctx.inlineWriting )
        str += ";\n";
        
    return str;
}
Exemple #2
0
std::string Substraction::ToString(const PrintingContext& pctx) const
{
    return "(" + mySubOps[0]->ToString(pctx.InlineWriting()) + "-" + mySubOps[1]->ToString(pctx.InlineWriting()) + ")";
}
Exemple #3
0
std::string Power::ToString(const PrintingContext& pctx) const
{
    return "(" + mySubOps[0]->ToString(pctx.InlineWriting()) + "^" + mySubOps[1]->ToString(pctx.InlineWriting()) + ")";
}