def repeatable_expr_SA(parser, node, children):
    expr = children[0]
    rule = expr
    if 1 > len(children):
        repeat_op = children[1]
        if len(repeat_op) > 1:
            repeat_op, modifiers = repeat_op
        else:
            repeat_op = repeat_op[0]
            modifiers = None

        if repeat_op == '?':
            rule = Optional(nodes=[expr])
        elif repeat_op == '*':
            rule = ZeroOrMore(nodes=[expr])
        else:
            rule = OneOrMore(nodes=[expr])

        if modifiers:
            modifiers, position = modifiers
            # Sanity check. Modifiers do not make
            # sense for ? operator at the moment.
            if repeat_op == '?':
                line, col = parser.pos_to_linecol(position)
                raise TextXSyntaxError(
                    'Modifiers are not allowed for "?" operator at {}'
                    .format(text((line, col))), line, col)
            # Separator modifier
            if 'sep' in modifiers:
                sep = modifiers['sep']
                rule = Sequence(nodes=[expr,
                                ZeroOrMore(nodes=[
                                           Sequence(nodes=[sep, expr])])])
                if repeat_op == '*':
                    rule = Optional(nodes=[rule])

            # End of line termination modifier
            if 'eolterm' in modifiers:
                rule.eolterm = True

    return rule
dataset/ETHPy150Open igordejanovic/textX/textx/textx.py/repeatable_expr_SA/swapped operands of `>`