def validate_whens(ctx, line_num, whens): for when in whens: checkF(when.lstrip('!') in ctx.all_whens, '{}: bad when: {}', line_num, when)
def validate_keys(line_num, keys): for word in keys: for el in word.split('+'): checkF(key_validator.fullmatch(el), '{}: bad key: {!r}', line_num, el)