示例#1
0
void Preprocessor::handleSpecialMacro(const LineIterator& line)
{
    trim(*line);
    if(*line == "skip whitespace")
        rm_ws = !rm_ws;
    else if(*line == "reduce whitespace")
        rd_ws = !rd_ws;
    else if(line->substr(0, 7) == "include")
        handleIncludeMacro(line->substr(line->find(' ') + 1), line);
}
示例#2
0
void Preprocessor::addMacro(const LineIterator& line)
{
    *line = line->substr(1);
    size_t pos = line->find(":=");
    if(pos == std::string::npos)
        return handleSpecialMacro(line);

    std::string name = line->substr(0, pos);
    trim(name);
    std::string replacement = line->substr(pos + 2);
    trim(replacement);
    parseEscapes(replacement);
    aliases.push_back(Alias(name, replacement));
}