July 05, 2018 Re: Parenthesis around if/for/while condition is not necessary | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On Wednesday, 4 July 2018 at 14:37:49 UTC, Timon Gehr wrote:
> On 24.06.2018 13:27, Basile B. wrote:
>>
>> FYI this works fine, as expected it's just some small parser changes.
>> I didn't touch to for and foreach for now. I think that SwitchStatement is a candidate too.
>>
>> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d
>
> if (a+b)*c == d { ... }
right, maybe logic to apply here is : if the expression parses and no closing paren is found then it's not nececessary.
|
July 05, 2018 Re: Parenthesis around if/for/while condition is not necessary | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Thursday, 5 July 2018 at 09:45:44 UTC, Basile B. wrote:
> On Wednesday, 4 July 2018 at 14:37:49 UTC, Timon Gehr wrote:
>> On 24.06.2018 13:27, Basile B. wrote:
>>>
>>> FYI this works fine, as expected it's just some small parser changes.
>>> I didn't touch to for and foreach for now. I think that SwitchStatement is a candidate too.
>>>
>>> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d
>>
>> if (a+b)*c == d { ... }
>
> right, maybe logic to apply here is : if the expression parses and no closing paren is found then it's not nececessary.
Actually with the change the example doesn't parse and without it didn't either.
The program meaning is not altered so it's fine.
|
Copyright © 1999-2021 by the D Language Foundation