[fpc-pascal] string-type

Adriaan van Os adriaan at adriaan.biz
Wed Dec 20 22:09:33 CET 2023


Adriaan van Os via fpc-pascal wrote:
> Section 3.2.4 of the FreePascal Language Reference defines <string-type>
> 
>     string-type = "STRING" [ "[" unsigned-integer "]" ] | "TYPE" ( 
> "STRING" | "ansistring" ) "(" unsigned-integer ")" .
> 
> Ansistring is shown in the syntax diagram in boldface and thus as a 
> keyword. But it is not listed as either a modifier or a reserved word in 
> section 1.3. I suggest instead to define <ansistring> as a type-identifier.
> 
>     string-type = "STRING" [ "[" unsigned-integer "]" ] | "TYPE" ( 
> "STRING" | ansistring ) "(" unsigned-integer ")" .
>     ansistring = type-identifier .

For other reasons, the indicated rule for <string-type> is not correct, as the size specifier and 
the codepage specifier can both be a <constant-identifier>. So, with that I think we get

	string-type = "STRING" [ "[" ( unsigned-integer | constant-identifier ) "]" ] | "TYPE" ( "STRING" 
| ansistring ) "(" ( unsigned-integer | constant-identifier ) ")" .

Regards,

Adriaan van Os


More information about the fpc-pascal mailing list