[fpc-pascal] case statement

Adriaan van Os adriaan at adriaan.biz
Thu Dec 14 18:34:45 CET 2023


Michael Van Canneyt via fpc-pascal wrote:
> 
> 
> On Thu, 14 Dec 2023, Adriaan van Os via fpc-pascal wrote:
> 
>>
>> I am looking in detail at the syntax diagrams in the Freepascal 
>> Language Reference (version 3.2.0)
>>
>> Section 13.2.2 discusses the case-statement. Translated to EBNF (WSN) 
>> the syntax is
>>
>> case-statement = "CASE" expression "OF" case { ";" case } [ else-part 
>> ] [ ";" ] .
>> case = constant [ ".." constant ] { "," constant [ ".." constant ] } 
>> ":" statement .
>> else-part = [ "ELSE" | "OTHERWISE" ] statementlist .
>>
>> If this is correct (and the compiler really allows it) then a 
>> semicolon between <case> and <else-part> is not required.
> 
> It is not required.

In addition to what I wrote, I believe the <case-statement> diagram is also incorrect in that it 
doesn't allow an optional semicolon between <case> and <else-part>.

Regards,

Adriaan van Os


More information about the fpc-pascal mailing list