Jump to content
Ian Branch

Missing procedures/functions in lookup??

Recommended Posts

9 hours ago, Ian Branch said:

Any idea why only 7 procedures/functions are being shown in the attached image when there are clearly many more??

Probably something in your code we cannot see that the parser stumbles upon.

Share this post


Link to post

Great Call Uwe,

If I comment out this function..

function ValidEmail(const EmailAddress: string): Boolean;
const
  EMAIL_REGEX = '^((?>[a-zA-Z\d!#$%&''*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])' + '[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)' +
    '(?>\.?[a-zA-Z\d!#$%&''*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])' + '[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]' +
    '{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d))' + '{4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\' + '[\x01-\x7f])+)\])(?(angle)>)$';
var
  Emails: TStringList;
begin
  Result := True;

  Emails := TStringList.Create;
  try
    Emails.Delimiter := ';';
    Emails.StrictDelimiter := True;
    Emails.DelimitedText := EmailAddress;
    for var I := 0 to Emails.Count - 1 do
      if not TRegEx.IsMatch(Emails[I], EMAIL_REGEX) then
      begin
        Result := False;
        Break;
      end;
  finally
    Emails.Free;
  end;
  //
end;

Then all the procedures/functions show.

Through a process of trial and error I found that if I change the code to the following..

function ValidEmail(const EmailAddress: string): Boolean;
const
  EMAIL_REGEX = '^((?>[a-zA-Z\d!#$%&''*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])' + '[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)' +
    '(?>\.?[a-zA-Z\d!#$%&''*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])' + '[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]' +
    '{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d))' + '{4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\' + '[\x01-\x7f])+)\])(?(angle)>)$';
var
  Emails: TStringList;
  I: SmallInt;    //  <<<<<<  Add this
begin
  Result := True;

  Emails := TStringList.Create;
  try
    Emails.Delimiter := ';';
    Emails.StrictDelimiter := True;
    Emails.DelimitedText := EmailAddress;
    for I := 0 to Emails.Count - 1 do       //  <<<<<<<<<<<<  Change this..
      if not TRegEx.IsMatch(Emails[I], EMAIL_REGEX) then
      begin
        Result := False;
        Break;
      end;
  finally
    Emails.Free;
  end;
  //
end;

No more issue..

This is in D10.4.2.  I get the same in D11.  :-(

 

Regards and thanks again for the pointer...

 

Ian

 

Share this post


Link to post

Historically the IDE uses several parsers for different functionality. The goal is to move all these to the new LSP approach, but that needs time.

Share this post


Link to post

Grrrrr!!!

Checking through other Units/Projects I have found repeated instances of this happening where I have declared in-line variables.  :-(

Back to the old/original way of declaring them..

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×