示例#1
0
文件: case_.cpp 项目: signatal/strine
/**
 * Write the case out to the stream.
 *
 * @param out -- The output stream to write the if to.
 */
void Case_::Write_(Printer& out) const
{
    out.Indent();
    out.IgnoreNextIndent();

    out << "(case " << this->condition.ToString() << "\n";
    {
        Printer::TabMarker tab = out.Tab();
    }
    out.Indent();
    out << ')';
}
示例#2
0
/**
 * Write the quoted element out to the stream.
 *
 * @param out -- The output stream to write the evaluate to.
 */
void Quoted_::Write_(Printer& out) const
{
    out.Indent();
    out << "'";
    out.IgnoreNextIndent();
    this->element.Write(out);
}
示例#3
0
/**
 * Write the if out to the stream.
 *
 * @param out -- The output stream to write the if to.
 */
void If_::Write_(Printer& out) const
{
    out.Indent();
    out << "(if\n" ;
    {
        Printer::TabMarker tab = out.Tab();

        this->condition.Write(out);
        out << '\n';
        this->true_result.Write(out);
        out << '\n';
        this->false_result.Write(out);
        out << '\n';
    }
    out.Indent();
    out << ')';
}
示例#4
0
文件: set_.cpp 项目: signatal/strine
/**
 * Write the set out to the stream.
 *
 * @param out -- The output stream to write the set to.
 */
void Set_::Write_(Printer& out) const
{
    out.Indent();
    out << "(set " << this->id << ' ';
    if (this->global)
    {
        out << "~>\n";
    }
    else
    {
        out << "->\n";
    }

    {
        Printer::TabMarker marker = out.Tab();
        this->element.Write(out);
        out << '\n';
    }
    out.Indent();
    out << ')';
}
示例#5
0
void Number_::Write_(Printer& out) const
{ 
    out.Indent();
    if (this->is_int)
    {
        out << std::setprecision(0) << this->int_value ;
    }
    else
    {
        out << this->double_value;
    }
}
示例#6
0
void String_::Write_(Printer& out) const
{
    out.Indent();
    out << '"';

    std::string outputString;
    this->holder->Retrieve(outputString);
   
    out << String_::ToEscapeCharacters(outputString);

    out << '"';
}
示例#7
0
/**
 * Write the set out to the stream.
 *
 * @param out -- The output stream to write the set to.
 */
void Function_::Write_(Printer& out) const
{
    out.Indent();
    out << "(function ( ";
    
    size_t const NUMBER_OF_ARGS = this->args.size();
    for(size_t i=0; i<NUMBER_OF_ARGS; ++i)
    {
        out.IgnoreNextIndent();
        out << this->args[i].ToString() << ' '; 
    }
    out << ")\n";

    {
        Printer::TabMarker tab = out.Tab(); 
        this->body.Write(out);
        out << '\n';
    } 

    out.Indent();
    out << ')';
}
示例#8
0
/**
 * Write the set out to the stream.
 *
 * @param out -- The output stream to write the set to.
 */
void Builtin_::Write_(Printer& out) const
{
    out.Indent();
    if (this->additional_parameter.Type() == Types::NIL)
    {
        out << "(builtin \"" << Name() << "\")";
    }
    else
    {
        out << "(builtin \"" 
            << Name()
            << "\" " 
            << this->additional_parameter.ToString()
            << ")";
    }
}
示例#9
0
/**
 * Write to the output stream a description of a true element.
 * @param out -- The stream to write to.
 */
void True_::Write_(Printer& out ) const
{
    out.Indent();
    out << TRUE_TEXT;
}
示例#10
0
/**
 * Write to the output stream a description of a false element.
 * @param out -- The stream to write to.
 *
 * - JR Lewis       2012.01.13
 *   - Initial version.
 */
void False_::Write_(Printer& out ) const
{
    out.Indent();
    out << FALSE_TEXT;
}