Пример #1
0
static void PrintKeywordInfo(Log& output, const std::pair<std::string, Tokens>& key, size_t maxLen)
{
    static const size_t minSepCount = 3;

    /* Get final keyword info line */
    std::string info = key.first;

    auto hint = KeywordHint(key.second);
    if (hint)
        info += std::string(maxLen - info.size() + minSepCount, ' ') + std::string(hint);

    /* Push scoped color */
    std::unique_ptr<ScopedColor> color;

    switch (key.second)
    {
        case Tokens::Macro:
            color = MakeUnique<ScopedColor>(output.stream, Color::Green | Color::Intens);
            break;
        case Tokens::Reserved:
            color = MakeUnique<ScopedColor>(output.stream, Color::Red | Color::Intens);
            break;
    }

    /* Print message */
    output.Message(info);
}
Пример #2
0
static void PrintAttribs(Log& output)
{
    /* Print attributes */
    output.Headline("attributes:");

    for (const std::string& attr : { Attrib::idDeprecated,
                                     Attrib::idFinal,
                                     Attrib::idOverride,
                                     Attrib::idExport,
                                     Attrib::idBind,
                                     Attrib::idSet,
                                     Attrib::idGet })
    {
        output.Message(attr);
    }
}
Пример #3
0
void ReplyCommand::Execute(StreamParser& input, Log& output)
{
    using Flags = Assembler::QueryFlags;

    /* Parse input argument */
    auto filename = input.Accept();
    BitMask flags;

    while (true)
    {
        if (!flags(Flags::ExportAddresses) && input.Get() == "--exp-addr")
        {
            input.Accept();
            flags << Flags::ExportAddresses;
        }
        else if (!flags(Flags::ImportAddresses) && input.Get() == "--imp-addr")
        {
            input.Accept();
            flags << Flags::ImportAddresses;
        }
        else if (!flags(Flags::Invocations) && input.Get() == "--invk")
        {
            input.Accept();
            flags << Flags::Invocations;
        }
        else if ( !flags(Flags::SortByName) && ( input.Get() == "-S" || input.Get() == "--sort" ) )
        {
            input.Accept();
            flags << Flags::SortByName;
        }
        else
            break;
    }

    /* Show output */
    if (flags)
        Assembler::QueryByteCodeInformation(output, filename, flags);
    else
        output.Message("reply: nothing to be done");
}
Пример #4
0
static void PrintSearchPaths(Log& output)
{
    output.Headline("search paths:");
    output.Message("library path: \"" + SearchPaths::LibraryPath());
    output.Message("module path: \"" + SearchPaths::ModulesPath());
}