Commit 6f95dba7 authored by Stefan Behnel's avatar Stefan Behnel

keep ignoring unknown directives in directive comments

parent 2db8ba02
......@@ -120,7 +120,7 @@ def parse_directive_value(name, value, relaxed_bool=False):
else:
assert False
def parse_directive_list(s, relaxed_bool=False):
def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False):
"""
Parses a comma-seperated list of pragma options. Whitespace
is not considered.
......@@ -151,6 +151,8 @@ def parse_directive_list(s, relaxed_bool=False):
name, value = [ s.strip() for s in item.strip().split('=', 1) ]
parsed_value = parse_directive_value(name, value, relaxed_bool=relaxed_bool)
if parsed_value is None:
if not ignore_unknown:
raise ValueError('Unknown option: "%s"' % name)
else:
result[name] = parsed_value
return result
......@@ -2588,7 +2588,8 @@ def p_compiler_directive_comments(s):
if m:
directives = m.group(1).strip()
try:
result.update( Options.parse_directive_list(directives) )
result.update( Options.parse_directive_list(
directives, ignore_unknown=True) )
except ValueError, e:
s.error(e.args[0], fatal=False)
s.next()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment