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): ...@@ -120,7 +120,7 @@ def parse_directive_value(name, value, relaxed_bool=False):
else: else:
assert False 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 Parses a comma-seperated list of pragma options. Whitespace
is not considered. is not considered.
...@@ -151,6 +151,8 @@ def parse_directive_list(s, relaxed_bool=False): ...@@ -151,6 +151,8 @@ def parse_directive_list(s, relaxed_bool=False):
name, value = [ s.strip() for s in item.strip().split('=', 1) ] name, value = [ s.strip() for s in item.strip().split('=', 1) ]
parsed_value = parse_directive_value(name, value, relaxed_bool=relaxed_bool) parsed_value = parse_directive_value(name, value, relaxed_bool=relaxed_bool)
if parsed_value is None: if parsed_value is None:
raise ValueError('Unknown option: "%s"' % name) if not ignore_unknown:
result[name] = parsed_value raise ValueError('Unknown option: "%s"' % name)
else:
result[name] = parsed_value
return result return result
...@@ -2588,7 +2588,8 @@ def p_compiler_directive_comments(s): ...@@ -2588,7 +2588,8 @@ def p_compiler_directive_comments(s):
if m: if m:
directives = m.group(1).strip() directives = m.group(1).strip()
try: try:
result.update( Options.parse_directive_list(directives) ) result.update( Options.parse_directive_list(
directives, ignore_unknown=True) )
except ValueError, e: except ValueError, e:
s.error(e.args[0], fatal=False) s.error(e.args[0], fatal=False)
s.next() 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