[fpc-devel] Semicolon before else
Aleksa Todorovic
alexione at gmail.com
Fri Jan 29 12:44:03 CET 2010
On Fri, Jan 29, 2010 at 12:11, Marc Weustink <marc.weustink at cuperus.nl> wrote:
> Aleksa Todorovic wrote:
>>
>> On Fri, Jan 29, 2010 at 11:42, Michael Van Canneyt
>> <michael at freepascal.org> wrote:
>>>
>>> It breaks the behavious of case:
>>>
>>> case b of
>>> 1 : something;
>>> 2 : If a then
>>> DoSomethingElse;
>>> else
>>> DoElse
>>> end;
>>>
>>> As it is now, b=2 and a=False will result in no code executed.
>>>
>>> After the patch, B=2 and a=False will result in DoElse.
>>>
>>
>> Have you actually tried it? I've tested those cases and they should work.
>
>
> Then in your patch, how do you distinguish between the else belonging to the
> case statement and the else belonging to the if ?
When compiler hits 'end' inside 'case', it analyzes syntax tree
created for the last branch, and checks if there was semicolon before
last else or not (which is clear sign if that else is part of if
statement or case).
More information about the fpc-devel
mailing list