| 3286 | } |
| 3287 | |
| 3288 | static bool preprocessToken(simplecpp::TokenList &output, const simplecpp::Token *&tok1, simplecpp::MacroMap ¯os, std::vector<std::string> &files, simplecpp::OutputList *outputList) |
| 3289 | { |
| 3290 | const simplecpp::Token * const tok = tok1; |
| 3291 | const simplecpp::MacroMap::const_iterator it = tok->name ? macros.find(tok->str()) : macros.end(); |
| 3292 | if (it != macros.end()) { |
| 3293 | simplecpp::TokenList value(files); |
| 3294 | try { |
| 3295 | tok1 = it->second.expand(value, tok, macros, files); |
| 3296 | } catch (const simplecpp::Macro::Error &err) { |
| 3297 | if (outputList) { |
| 3298 | simplecpp::Output out{ |
| 3299 | simplecpp::Output::SYNTAX_ERROR, |
| 3300 | err.location, |
| 3301 | "failed to expand \'" + tok->str() + "\', " + err.what |
| 3302 | }; |
| 3303 | outputList->emplace_back(std::move(out)); |
| 3304 | } |
| 3305 | return false; |
| 3306 | } |
| 3307 | output.takeTokens(value); |
| 3308 | } else { |
| 3309 | if (!tok->comment) |
| 3310 | output.push_back(new simplecpp::Token(*tok)); |
| 3311 | tok1 = tok->next; |
| 3312 | } |
| 3313 | return true; |
| 3314 | } |
| 3315 | |
| 3316 | static void getLocaltime(struct tm <ime) |
| 3317 | { |