[fpc-pascal] IsValidIdent() and identifiers escaped with &

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Feb 5 16:11:07 CET 2017


On Sun, 5 Feb 2017 14:24:46 +0000
Howard Page-Clark <hdpc at talktalk.net> wrote:

> Consider this program, which returns False:
> 
> program Project1;
> 
> uses sysutils;
> 
> var
>    &begin: boolean;
> 
> begin
>    &begin:=IsValidIdent('&begin');
>    WriteLn('IsValidIdent(''&begin'') evaluates to ', &begin);
> end.
> 
> Should sysutils.IsValidIdent() be updated to return True in this case?

The identifier is "begin". The & is an operator.
For example:

type
  TMyEnum = (&begin);
var
  e: TMyEnum = &begin;
begin
  writeln(e);
end.

gives "begin".


Mattias



More information about the fpc-pascal mailing list