def draw_productions_to_image(self, img_type, options, filename, tail): productions = self.get_productions() if len(productions) == 0: raise Exception("No named productions to generate") # Sort the specified tail productions to the end for name in tail: if name in productions: value = productions[name] del productions[name] productions[name] = value from parcon.railroad import raildraw as _raildraw _raildraw.draw_to_image(img_type, ordered_dict.OrderedDict([(k, Then(Bullet(), v.create_railroad(options), Bullet())) for k, v in productions.items()]), options, filename) del _raildraw
def draw_productions_to_image(self, img_type, options, filename, tail): productions = self.get_productions() if len(productions) == 0: raise Exception("No named productions to generate") # Sort the specified tail productions to the end for name in tail: if name in productions: value = productions[name] del productions[name] productions[name] = value from parcon.railroad import raildraw as _raildraw _raildraw.draw_to_image( img_type, ordered_dict.OrderedDict([ (k, Then(Bullet(), v.create_railroad(options), Bullet())) for k, v in productions.items() ]), options, filename) del _raildraw
text("4"), text("5"), text("6"), text("7"), text("8"), text("9") ), Bullet() ) ) ]) options = { "raildraw_title_before":20, "raildraw_title_after": 30, "raildraw_scale": 0.7 } draw_to_image(sys.argv[1], productions, options, sys.argv[2], True)