Open Kerntrick opened 1 year ago
Parser.bmx (2539ff)
a simple replacement:
Case "=",":*",":/",":+",":-",":&",":|",":~~","mod","shl","shr", ":shl", ":shr", "sar", ":sar", ":mod"
'replaced with
Case "=",":*",":/",":+",":-",":&",":|",":~~", ":shl", ":shr", ":sar", ":mod"
leads then to:
Compile Error: Expecting expression but encountered 'shl'
which looks OK to me.
A potential error message could be the one of this example:
SuperStrict
1 + 2
Which results in:
Compile Error: Expression cannot be used as a statement.
While I played with replacing it:
'"=","*=","/=","+=","-=","&=","|=","~~=","<<=",">>=","Sar=","%="
Case "=",":*",":/",":+",":-",":&",":|",":~~", ":shl", ":shr", ":sar", ":mod"
I saw this one (line 2569ff):
If TIdentExpr( expr )
expr=New TFuncCallExpr.Create( expr,ParseArgs( True ) )
Else If TFuncCallExpr( expr) Or TInvokeSuperExpr( expr ) Or TNewObjectExpr( expr ) Or TNewExpr(expr)
Else If TIndexExpr(expr)
expr = New TFuncCallExpr.Create( expr, ParseArgs( True ) )
Else
Err "Expression cannot be used as a statement."
EndIf
Isn't that second
Else If TIndexExpr(expr)
expr = New TFuncCallExpr.Create( expr, ParseArgs( True ) )
never used? Aka ... can be removed.
OR! was the original intentation to check it again (once "expr" got the TFuncCallExpr assigned)?
If TIdentExpr( expr )
expr=New TFuncCallExpr.Create( expr,ParseArgs( True ) )
Else If TFuncCallExpr( expr) Or TInvokeSuperExpr( expr ) Or TNewObjectExpr( expr ) Or TNewExpr(expr)
End If
If Not TIndexExpr(expr)
Err "Expression cannot be used as a statement."
EndIf
Example:
Gives the error:
Occurs with Mod, Shl, Shr,