deniszykov / csharp-eval-unity3d

C# Expression Parser for Unity3D
Other
203 stars 25 forks source link

The expression of "1 == 2 ? Random.Range(0, 1) : 3" results in a parser exception #4

Closed zzxiang closed 6 years ago

zzxiang commented 6 years ago

The expression is:

1 == 2 ? Random.Range(0, 1) : 3

The following exception is reported:

ExpressionParserException: A colon ':' symbol is expected in conditional '?' expression.

Changing Random.Range(0, 1) to Random.value makes the exception disappear.

However, 1 == 2 ? 3 : Random.Range(0, 1) can be correctly parsed.

deniszykov commented 6 years ago

Hi! Thanks for report. I will look what is wrong with parser.

deniszykov commented 6 years ago

I have fixed this issue in 09eec9fea8443288eec5696b619cbec0e9b11ca8 commit. You could take new dll here.

zzxiang commented 6 years ago

Yes! It does work now! Thank you very much for the quick fix!