[fpc-pascal] Codetools, identity nodes from includes
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Jul 6 23:57:46 CEST 2020
On Mon, 6 Jul 2020 10:27:55 +0700
Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> Currently I walk the node tree for a given unit and collect all the
> relevant symbols into a list which represents the symbols in the
> current document. I'm running into problems with include files
> because I'm getting symbols which technically belong to another file
> which should not be displayed according to the LSP.
>
> Given a TCodeTreeNode can I identity if the node came from an include
> file or not so I can ignore it?
Something like this:
Node:=AItem.Node;
if Node<>nil then
begin
Scanner:=Tool.Scanner;
LinkIndex:=Scanner.LinkIndexAtCleanPos(Node.StartPos);
if LinkIndex<0 then
// dangling node, e.g. syntax error
else
InIncludeFile:=Scanner.LinkP[LinkIndex]^.Code<>Scanner.MainCode;
end else
; // artificial node, e.g. intrinsic
Mattias
More information about the fpc-pascal
mailing list