コード例 #1
0
ファイル: builder.py プロジェクト: uxvworks/matlab2cpp
    def create_switch(self, parent, cur):
        """
Create switch-branch

| Structure (main):
|   Switch
|   | <cond expression>
|   | <case>+
|   | <otherwise>?
|
| Structure (case):
|   Case
|   | <cond expression>
|   | <code block>
|
| Structure (otherwise):
|   Otherwise
|   | <code block>

Args:
    parent (Block): Reference to parent node
    cur (int): position where switch is identified

Returns:
    int: position where switch ends

See also:
    :py:func:`matlab2cpp.tree.branches.switch`
    """
        assert isinstance(parent, mc.collection.Block)
        return branches.switch(self, parent, cur)
コード例 #2
0
    def create_switch(self, parent, cur):
        """
Create switch-branch

| Structure (main):
|   Switch
|   | <cond expression>
|   | <case>+
|   | <otherwise>?
|
| Structure (case):
|   Case
|   | <cond expression>
|   | <code block>
|
| Structure (otherwise):
|   Otherwise
|   | <code block>

Args:
    parent (Block): Reference to parent node
    cur (int): position where switch is identified

Returns:
    int: position where switch ends

See also:
    :py:func:`matlab2cpp.tree.branches.switch`
    """
        assert isinstance(parent, mc.collection.Block)
        return branches.switch(self, parent, cur)