[fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

tsiegel at softcon.com tsiegel at softcon.com
Thu Feb 8 23:36:38 CET 2024


No, the original post has the correct program, dropping a ";" in that 
spot is incorrect syntax.

The problem comes in because there is an open comment, but no close 
comment.  If you add the closing } the compiler behaves properly.

On the other hand, I do understand that once the "end." is encountered, 
further processing is unnecessary, and so the error shouldn't occur, 
because any text showing up after that should be ignored.

Honestly, it's is a case of six of one, half dozen of the other. It's 
all in the design of the compiler.  I personally wouldn't consider it a 
bug, but I can see why some folks would, so <shrug>


On 2/8/2024 7:01 PM, Martin Wynne via fpc-pascal wrote:
> Hi Thomas,
>
> The error is not the file content after "end.".
>
> The error is not having the expected "end;" after "begin".
>
> This works ok:
>
> _________________________
>
> program test;
>
> begin
> end;
>
> end.
>
> abc 123
>
> _________________________
>
> Martin.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list