views:

157

answers:

1

I have noticed quite a few times that syntax errors like

Exit(push(ASBDD(asPixmap, _ScriptSavePixmap(Script, PMRGBAdjust(_ScriptGetPixmap(Script, Args[0].Index), adjparams))));

actually compiles. Notice that one closing bracket ) is missing. (Of course it also compiles if I add this missing bracket!)

Is this a documented feature?

+5  A: 

Additional info: The statement in question is the last statement in a code block. Inserting any statement after this statement will cause the compiler to report the correct missing ")" error.

It would appear that the compiler loses track of the missing ")" error when it encounters the end of the block. This is most likely a compiler bug. It seems likely to me that this anomaly has been around for a long time. Don't rely on it.

dthorpe
No, that is not it. It will compile even if I remove `exit` entirely.
Andreas Rejbrand
Does it matter if this call is the last statement in the block? (Does it still compile if you add additional statements after the Exit() call?)
dthorpe
It seems like the statement has the be the last one in its block.
Andreas Rejbrand
Ok, that's probably the anomaly then. It sounds like the compiler is closing up shop upon discovering the end of the block before reporting the missing paren. I'd call it a bug, and chances are it has been there for decades. ;> My advice is to stick to the documented syntax and do not rely on the presence of this anomaly.
dthorpe
@Ralph: Done. Thanks.
dthorpe