X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=parsing.py;h=7240b5243e40ffd7655b4dc5bc4fbb94fbe65f5a;hp=42f0ec82a0e890a5ec876b200d7037aac6c31f25;hb=74c7456042282dd86f9be673cbd1e00496b28710;hpb=b059a00e0e2511a2ca2477db1e91d53fc5d2ec0f diff --git a/parsing.py b/parsing.py index 42f0ec8..7240b52 100644 --- a/parsing.py +++ b/parsing.py @@ -274,10 +274,16 @@ FurProgram = collections.namedtuple( ) def _function_call_expression_parser(index, tokens): - # TODO Use a FurSymbolExpression for the name + # TODO Allow function calls as the source of the function. This requires a + # left-recursive parser, however. failure = (False, index, None) - success, index, function = _symbol_expression_parser(index, tokens) + # We have to be careful what expressions we add here. Otherwise expressions + # like "a + b()" become ambiguous to the parser. + success, index, function = _or_parser( + _symbol_expression_parser, + _parenthesized_expression_parser, + )(index, tokens) if not success: return failure