Prints all identifiers for a C++ source file. Args: filename: 'file1' should_print: predicate with signature: bool Function(token)
(filename, should_print)
| 1664 | |
| 1665 | |
| 1666 | def PrintIndentifiers(filename, should_print): |
| 1667 | """Prints all identifiers for a C++ source file. |
| 1668 | |
| 1669 | Args: |
| 1670 | filename: 'file1' |
| 1671 | should_print: predicate with signature: bool Function(token) |
| 1672 | """ |
| 1673 | source = utils.ReadFile(filename, False) |
| 1674 | if source is None: |
| 1675 | sys.stderr.write('Unable to find: %s\n' % filename) |
| 1676 | return |
| 1677 | |
| 1678 | #print('Processing %s' % actual_filename) |
| 1679 | builder = BuilderFromSource(source, filename) |
| 1680 | try: |
| 1681 | for node in builder.Generate(): |
| 1682 | if should_print(node): |
| 1683 | print(node.name) |
| 1684 | except KeyboardInterrupt: |
| 1685 | return |
| 1686 | except: |
| 1687 | pass |
| 1688 | |
| 1689 | |
| 1690 | def PrintAllIndentifiers(filenames, should_print): |
no test coverage detected