| 242 | |
| 243 | |
| 244 | void Preprocessor::Finalize(TokenSequence os) { |
| 245 | while (!os.Empty()) { |
| 246 | auto tok = os.Next(); |
| 247 | if (tok->tag_ == Token::INVALID) { |
| 248 | Error(tok, "stray token in program"); |
| 249 | } |
| 250 | else if (tok->tag_ == Token::IDENTIFIER) { |
| 251 | auto tag = Token::KeyWordTag(tok->str_); |
| 252 | if (Token::IsKeyWord(tag)) { |
| 253 | const_cast<Token*>(tok)->tag_ = tag; |
| 254 | } |
| 255 | else { |
| 256 | const_cast<Token*>(tok)->str_ = Scanner(tok).ScanIdentifier(); |
| 257 | } |
| 258 | } |
| 259 | if (!tok->loc_.filename_) { |
| 260 | assert(false); |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | |
| 266 | // TODO(wgtdkp): add predefined macros |
no test coverage detected