git @ Cat's Eye Technologies SixtyPical / 0593ce6
Move merge_programs() out of main. Handle missing -o options. Chris Pressey 3 years ago
2 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1717 import sys
1818 import traceback
1919
20 from sixtypical.parser import Parser, ParsingContext
20 from sixtypical.parser import Parser, ParsingContext, merge_programs
2121 from sixtypical.analyzer import Analyzer
2222 from sixtypical.outputter import outputter_class_for
2323 from sixtypical.compiler import Compiler
24
25
26 def merge_programs(programs):
27 """Assumes that the programs do not have any conflicts."""
28
29 from sixtypical.ast import Program
30
31 full = Program(1, defns=[], routines=[])
32 for p in programs:
33 full.defns.extend(p.defns)
34 full.routines.extend(p.routines)
35
36 return full
3724
3825
3926 def process_input_files(filenames, options):
7562 compilation_roster = fa.serialize()
7663 dump(compilation_roster)
7764
78 if options.analyze_only:
65 if options.analyze_only or options.output is None:
7966 return
8067
8168 start_addr = None
478478 return SingleOp(self.scanner.line_number, opcode='trash', src=None, dest=dest)
479479 else:
480480 self.syntax_error('bad opcode "%s"' % self.scanner.token)
481
482
483 # - - - -
484
485
486 def merge_programs(programs):
487 """Assumes that the programs do not have any conflicts."""
488
489 full = Program(1, defns=[], routines=[])
490 for p in programs:
491 full.defns.extend(p.defns)
492 full.routines.extend(p.routines)
493
494 return full