| 325 | |
| 326 | |
| 327 | void process_file ( |
| 328 | istream& fin, |
| 329 | const string& file, |
| 330 | std::vector<tok_function_record>& functions, |
| 331 | std::vector<tok_class_record>& classes |
| 332 | ) |
| 333 | /*! |
| 334 | ensures |
| 335 | - scans the given file for global functions and appends any found into functions. |
| 336 | - scans the given file for global classes and appends any found into classes. |
| 337 | !*/ |
| 338 | { |
| 339 | tok_type tok; |
| 340 | tok.set_stream(fin); |
| 341 | |
| 342 | bool recently_seen_struct_keyword = false; |
| 343 | // true if we have seen the struct keyword and |
| 344 | // we have not seen any identifiers or { characters |
| 345 | |
| 346 | string last_struct_name; |
| 347 | // the name of the last struct we have seen |
| 348 | |
| 349 | bool recently_seen_class_keyword = false; |
| 350 | // true if we have seen the class keyword and |
| 351 | // we have not seen any identifiers or { characters |
| 352 | |
| 353 | string last_class_name; |
| 354 | // the name of the last class we have seen |
| 355 | |
| 356 | bool recently_seen_namespace_keyword = false; |
| 357 | // true if we have seen the namespace keyword and |
| 358 | // we have not seen any identifiers or { characters |
| 359 | |
| 360 | string last_namespace_name; |
| 361 | // the name of the last namespace we have seen |
| 362 | |
| 363 | bool recently_seen_pound_define = false; |
| 364 | // true if we have seen a #define and haven't seen an unescaped newline |
| 365 | |
| 366 | bool recently_seen_preprocessor = false; |
| 367 | // true if we have seen a preprocessor statement and haven't seen an unescaped newline |
| 368 | |
| 369 | bool recently_seen_typedef = false; |
| 370 | // true if we have seen a typedef keyword and haven't seen a ; |
| 371 | |
| 372 | bool recently_seen_paren_0 = false; |
| 373 | // true if we have seen paren_count transition to zero but haven't yet seen a ; or { or |
| 374 | // a new line if recently_seen_pound_define is true. |
| 375 | |
| 376 | bool recently_seen_slots = false; |
| 377 | // true if we have seen the identifier "slots" at a zero scope but haven't seen any |
| 378 | // other identifiers or the ';' or ':' characters. |
| 379 | |
| 380 | bool recently_seen_closing_bracket = false; |
| 381 | // true if we have seen a } and haven't yet seen an IDENTIFIER or ; |
| 382 | |
| 383 | bool recently_seen_new_scope = false; |
| 384 | // true if we have seen the keywords class, namespace, struct, or extern and |
no test coverage detected