Exemplo n.º 1
0
 def visit_Node(self, item):
     color = (
         GREEN
         if item.interpretator
         else BLUE
     )
     self.style(
         item,
         style(label=item.label, fillcolor=color)
     )
     if item.relation:
         self.relations.add(item.relation, item)
Exemplo n.º 2
0
 def __call__(self, root):
     graph = super(DotTreeTransformator, self).__call__(root)
     for edge in self.relations.edges:
         graph.add_edge(
             edge.first,
             edge.second,
             style=style(
                 label=edge.relation.label,
                 dir='none',
                 style='dashed'
             )
         )
     return graph
Exemplo n.º 3
0
 def visit_RelationRule(self, item):
     self.style(item, style(label=item.relation.label, fillcolor=PURPLE))
Exemplo n.º 4
0
 def visit_InterpretationRule(self, item):
     self.style(item, style(label=item.interpretator.label,
                            fillcolor=GREEN))
Exemplo n.º 5
0
 def visit_NamedRule(self, item):
     self.style(item, style(label=item.name, fillcolor=RED))
Exemplo n.º 6
0
 def visit_MinMaxBoundedRule(self, item):
     self.style(
         item,
         style(label='MinMaxBounded [item.min, item.max]'.format(item=item),
               fillcolor=ORANGE))
Exemplo n.º 7
0
 def visit_MaxBoundedRule(self, item):
     self.style(item,
                style(label='MaxBounded <=%d' % item.max, fillcolor=ORANGE))
Exemplo n.º 8
0
 def visit_PipelineRule(self, item):
     self.style(item, style(label=item.pipeline.label, fillcolor=PURPLE))
Exemplo n.º 9
0
 def visit_OptionalRule(self, item):
     self.style(item, style(label='Optional', fillcolor=ORANGE))
Exemplo n.º 10
0
 def visit_OrRule(self, item):
     self.style(item, style(label='Or', fillcolor=BLUE))
Exemplo n.º 11
0
 def visit_PipelineProduction(self, item):
     self.style(item, style(label='PipelineProduction', fillcolor=BLUE))
Exemplo n.º 12
0
 def visit_EmptyProduction(self, item):
     self.style(item, style(label='EmptyProduction'))
Exemplo n.º 13
0
 def visit_Production(self, item):
     self.graph.add_node(item, style(label='Production', fillcolor=BLUE))
     for index, child in enumerate(item.children):
         styling = (style(color=DARKGRAY)
                    if item.main > 0 and item.main == index else None)
         self.graph.add_edge(item, child, style=styling)
Exemplo n.º 14
0
 def visit_Predicate(self, item):
     self.style(item, style(label=item.label))
Exemplo n.º 15
0
 def visit_Leaf(self, item):
     self.style(
         item,
         style(label=item.label)
     )
Exemplo n.º 16
0
 def visit_ForwardRule(self, item):
     self.style(item, style(label='Forward', fillcolor=PURPLE))
Exemplo n.º 17
0
 def visit_EmptyRule(self, item):
     self.style(item, style(label='Empty'))
Exemplo n.º 18
0
 def visit_RepeatableOptionalRule(self, item):
     self.style(item, style(label='RepeatableOptional', fillcolor=ORANGE))
Exemplo n.º 19
0
 def visit_BNFRule(self, item):
     self.style(item, style(label=item.label, fillcolor=GREEN))
Exemplo n.º 20
0
 def visit_MinBoundedRule(self, item):
     self.style(item,
                style(label='MinBounded >=%d' % item.min, fillcolor=ORANGE))