Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
                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)