def _get_textx_rule_name(parent_rule):
    """
    Iterate parent instances until `TextxRule` instance.
    """
    while not type(parent_rule).__name__ == 'TextxRule':
        parent_rule = parent_rule.parent
    return parent_rule.name
