def textx_rule_SA(parser, node, children):
    if 2 > len(children):
        rule_name, rule_params, rule = children
    else:
        rule_name, rule = children
        rule_params = {}

    if rule.rule_name.startswith('__asgn') or\
            (isinstance(rule, Match) and rule_params):
        # If it is assignment node it must be kept because it could be
        # e.g., single assignment in the rule.
        # Also, handle a special case where rule consists only of a single match
        # and there are rule modifiers defined.
        rule = Sequence(nodes=[rule], rule_name=rule_name,
                        root=True, **rule_params)
    else:
        if not isinstance(rule, RuleCrossRef):
            # Promote rule node to root node.
            rule.rule_name = rule_name
            rule.root = True
            for param in rule_params:
                setattr(rule, param, rule_params[param])

    # Connect meta-class and the PEG rule
    parser.metamodel._set_rule(rule_name, rule)

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