Esempio 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)
Esempio 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
Esempio n. 3
0
 def visit_RelationRule(self, item):
     self.style(item, style(label=item.relation.label, fillcolor=PURPLE))
Esempio n. 4
0
 def visit_InterpretationRule(self, item):
     self.style(item, style(label=item.interpretator.label,
                            fillcolor=GREEN))
Esempio n. 5
0
 def visit_NamedRule(self, item):
     self.style(item, style(label=item.name, fillcolor=RED))
Esempio n. 6
0
 def visit_MinMaxBoundedRule(self, item):
     self.style(
         item,
         style(label='MinMaxBounded [item.min, item.max]'.format(item=item),
               fillcolor=ORANGE))
Esempio n. 7
0
 def visit_MaxBoundedRule(self, item):
     self.style(item,
                style(label='MaxBounded <=%d' % item.max, fillcolor=ORANGE))
Esempio n. 8
0
 def visit_PipelineRule(self, item):
     self.style(item, style(label=item.pipeline.label, fillcolor=PURPLE))
Esempio n. 9
0
 def visit_OptionalRule(self, item):
     self.style(item, style(label='Optional', fillcolor=ORANGE))
Esempio n. 10
0
 def visit_OrRule(self, item):
     self.style(item, style(label='Or', fillcolor=BLUE))
Esempio n. 11
0
 def visit_PipelineProduction(self, item):
     self.style(item, style(label='PipelineProduction', fillcolor=BLUE))
Esempio n. 12
0
 def visit_EmptyProduction(self, item):
     self.style(item, style(label='EmptyProduction'))
Esempio 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)
Esempio n. 14
0
 def visit_Predicate(self, item):
     self.style(item, style(label=item.label))
Esempio n. 15
0
 def visit_Leaf(self, item):
     self.style(
         item,
         style(label=item.label)
     )
Esempio n. 16
0
 def visit_ForwardRule(self, item):
     self.style(item, style(label='Forward', fillcolor=PURPLE))
Esempio n. 17
0
 def visit_EmptyRule(self, item):
     self.style(item, style(label='Empty'))
Esempio n. 18
0
 def visit_RepeatableOptionalRule(self, item):
     self.style(item, style(label='RepeatableOptional', fillcolor=ORANGE))
Esempio n. 19
0
 def visit_BNFRule(self, item):
     self.style(item, style(label=item.label, fillcolor=GREEN))
Esempio n. 20
0
 def visit_MinBoundedRule(self, item):
     self.style(item,
                style(label='MinBounded >=%d' % item.min, fillcolor=ORANGE))