Fix required keys handling: do not require more keys then required

This commit is contained in:
ZyX 2014-08-03 04:48:27 +04:00
parent fc40c80be2
commit 23ec5efb41

View File

@ -683,11 +683,10 @@ type_keys = {
'filler': set(('type', 'highlight_group', 'divider_highlight_group')), 'filler': set(('type', 'highlight_group', 'divider_highlight_group')),
} }
required_keys = { required_keys = {
'function': set(), 'function': set(('name',)),
'string': set(('contents',)), 'string': set(('contents',)),
'filler': set(), 'filler': set(),
} }
function_keys = set(('args', 'module'))
highlight_keys = set(('highlight_group', 'name')) highlight_keys = set(('highlight_group', 'name'))
@ -712,7 +711,7 @@ def check_key_compatibility(segment, data, context, echoerr):
problem_mark=list(unknown_keys)[0].mark) problem_mark=list(unknown_keys)[0].mark)
hadproblem = True hadproblem = True
if not (keys > required_keys[segment_type]): if not (keys >= required_keys[segment_type]):
missing_keys = required_keys[segment_type] - keys missing_keys = required_keys[segment_type] - keys
echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)), echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)),
context_mark=context[-1][1].mark, context_mark=context[-1][1].mark,