We weren't including this left parenthesis in the argument's token
list so the nested function invocation wasn not being recognized.
With this fix, tests 21 and 22 now pass.
if (node == NULL || node->token->type != '(')
return FUNCTION_NOT_A_FUNCTION;
+ last = node;
+ node = node->next;
+
argument = NULL;
- for (paren_count = 0; node; last = node, node = node->next) {
+ for (paren_count = 1; node; last = node, node = node->next) {
if (node->token->type == '(')
{
paren_count++;
break;
}
}
- else if (node->token->type == ',' &&
+
+ if (node->token->type == ',' &&
paren_count == 1)
{
argument = NULL;