Skip to content
Snippets Groups Projects
Commit 1abcf24b authored by Ladislav Lhotka's avatar Ladislav Lhotka
Browse files

Add case node also inside group.

parent 83f89f94
No related branches found
No related tags found
No related merge requests found
......@@ -552,6 +552,17 @@ class GroupNode(InternalNode):
def _state_roots(self) -> List[SchemaNode]:
return []
def _handle_child(self, node: SchemaNode, stmt: Statement,
mid: ModuleId) -> None:
if not isinstance(self.parent, ChoiceNode) or isinstance(node, CaseNode):
super()._handle_child(node, stmt, mid)
else:
cn = CaseNode()
cn.name = stmt.argument
cn.ns = self._new_ns if self._new_ns else self.ns
self.add_child(cn)
cn._handle_child(node, stmt, mid)
def _pattern_entry(self) -> SchemaPattern:
return super()._schema_pattern()
......@@ -931,7 +942,7 @@ class ChoiceNode(InternalNode):
def _tree_line_prefix(self) -> str:
return super()._tree_line_prefix() + ("rw" if self.config else "ro")
def _handle_child(self, node: SchemaNode, stmt: SchemaNode,
def _handle_child(self, node: SchemaNode, stmt: Statement,
mid: ModuleId) -> None:
if isinstance(node, CaseNode):
super()._handle_child(node, stmt, mid)
......@@ -960,6 +971,9 @@ class CaseNode(InternalNode):
self.parent._add_default_child(self)
super()._add_default_child(node)
def _pattern_entry(self) -> SchemaPattern:
return super()._schema_pattern()
def _tree_line(self) -> str:
"""Return the receiver's contribution to tree diagram."""
return "{}:({})".format(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment