[fpc-pascal] Very odd case parsing problem

Martin Frb lazarus at mfriebe.de
Sun Dec 29 15:06:47 CET 2013


On 29/12/2013 07:33, Mark Morgan Lloyd wrote:
> Saunders, Rich wrote:
>> On 2013-12-28 15:47, Mark Morgan Lloyd wrote:
>>>
>>>       quit_:       if High(lexemeListArray) = 1 then begin
>>>                    end;
>>>       nop:         begin end
>>>     else
....
> Drat- a dangling else in a case! I should have spotted that, but 
> instead spent an hour or so picking at it.
>

1) If you use Lazarus then you can have case-labels highlighted (e.g add 
underline/border, blend foreground by mixing in another color, bold, 
...) It is in the color config.

That will (in this case) not highlight the else, so you will know the 
else is part of the if.

2) I tried your code and it compiles (2.6.2 win32)

{$mode objfpc}{$H+}


procedure TForm1.FormCreate(Sender: TObject);
var
   a: (help, help_, quit_);
   b: Integer;
begin
    try
     case a of
       help:        begin
                    end;
       help_:       begin
                    end;
       quit_:       if b = 1 then begin
                    end
     else
     end // line 323
   finally
   end;
end;




More information about the fpc-pascal mailing list