[fpc-pascal] Very odd case parsing problem

Saunders, Rich greymont at mykolab.com
Sun Dec 29 00:03:59 CET 2013


On 2013-12-28 15:47, Mark Morgan Lloyd wrote:
> I can fix that either by putting a semicolon before the else- which I
> believe is strictly incorrect- or by putting begin/end around that
> conditional, or by inserting a dummy statement before the else like
> 
>       quit_:       if High(lexemeListArray) = 1 then begin
>                    end;
>       nop:         begin end
>     else

The problem is the compiler associates the else with the if..then and 
not with the case statement. All your fixes break the possible 
connection between the else and the if..then and that's why they work.

Your first fix (to just add a semicolon) would be my preferred one. I 
have lots of code that is written that way. I'm not sure why you think 
this is "strictly incorrect".

-- 

Cheers!
Rich Saunders



More information about the fpc-pascal mailing list