(filenames, *,
raw=False,
iter_filenames=None,
**kwargs
)
| 87 | |
| 88 | |
| 89 | def cmd_preprocess(filenames, *, |
| 90 | raw=False, |
| 91 | iter_filenames=None, |
| 92 | **kwargs |
| 93 | ): |
| 94 | if 'get_file_preprocessor' not in kwargs: |
| 95 | kwargs['get_file_preprocessor'] = _get_preprocessor() |
| 96 | if raw: |
| 97 | def show_file(filename, lines): |
| 98 | for line in lines: |
| 99 | print(line) |
| 100 | #print(line.raw) |
| 101 | else: |
| 102 | def show_file(filename, lines): |
| 103 | for line in lines: |
| 104 | linefile = '' |
| 105 | if line.filename != filename: |
| 106 | linefile = f' ({line.filename})' |
| 107 | text = line.data |
| 108 | if line.kind == 'comment': |
| 109 | text = '/* ' + line.data.splitlines()[0] |
| 110 | text += ' */' if '\n' in line.data else r'\n... */' |
| 111 | print(f' {line.lno:>4} {line.kind:10} | {text}') |
| 112 | |
| 113 | filenames = main_for_filenames(filenames, iter_filenames) |
| 114 | for filename in filenames: |
| 115 | lines = _iter_preprocessed(filename, **kwargs) |
| 116 | show_file(filename, lines) |
| 117 | |
| 118 | |
| 119 | def _cli_data(parser): |
nothing calls this directly
no test coverage detected
searching dependent graphs…