CommandHelper

CommandHelper

46.5k Downloads

Weird "Mismatched parenthesis" error

LadyCailinBot opened this issue ยท 2 comments

commented

CMDHELPER-3039 - Reported by Nessiesson

The following code throws a "Mismatched parenthesis" error:
array(string(1): 1);
This also happens if you put a space infront of the colon like:
array(string(1) : 1);

commented

Comment by Pieter12345

I believe the actual problem here is that array indices can not be anything other than strings/bare strings (not smart strings though) when using the array(@var:'val') format. array_set(@array, @index, @value) does work though. This problem has to be fixed in the compiler/optimizer.

A few examples of what happends now:
Unexpected: @A = array(string(1):'value') -> optimizer -> Configuration Compile Exception: Invalid label specified.
Unexpected: @A = array("1":'value') -> optimizer -> assign(@A,array(centry(smart_string:,'value')))
Expected: @A = array('1':'value') -> optimizer -> assign(@A,array(centry(1:,'value')))
Unexpected: array("1":2)['smart_string'] returns 2

commented

Comment by PseudoKnight

This was fixed to give an "Invalid label specified" error. Support for dynamic labels in the array() function would be a separate issue.