machine file: Fix parenthesized expressions

Extends 79ed2415e9. Thanks @bruchar1 for the test case; I got
absolutely lost trying to figure out where to add one.
This commit is contained in:
Tamás Bálint Misius 2023-12-22 21:02:58 +01:00 committed by Eli Schwartz
parent fbc744e6c6
commit 7700618181
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
2 changed files with 4 additions and 1 deletions

View File

@ -1097,6 +1097,8 @@ class MachineFileParser():
return node.value
elif isinstance(node, mparser.NumberNode):
return node.value
elif isinstance(node, mparser.ParenthesizedNode):
return self._evaluate_statement(node.inner)
elif isinstance(node, mparser.ArrayNode):
# TODO: This is where recursive types would come in handy
return [self._evaluate_statement(arg) for arg in node.args.arguments]

View File

@ -1,3 +1,4 @@
[properties]
astring = 'mystring'
anarray = ['one', 'two']
anarray = ['one', 'two']
withparentheses = ('anotherstring') # Ensure parentheses can be parsed