1from ..source import ( 2 opened as _open_source, 3) 4from . import common as _common 5 6 7def preprocess(lines, filename=None): 8 if isinstance(lines, str): 9 with _open_source(lines, filename) as (lines, filename): 10 yield from preprocess(lines, filename) 11 return 12 13 # XXX actually preprocess... 14 for lno, line in enumerate(lines, 1): 15 kind = 'source' 16 data = line 17 conditions = None 18 yield _common.SourceLine( 19 _common.FileInfo(filename, lno), 20 kind, 21 data, 22 conditions, 23 ) 24