[Lazarus] Parsing compiler directive with fcl-passrc

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Parsing compiler directive with fcl-passrc

Free Pascal - Lazarus mailing list
I know that in general, compiler directives are processed by the preprocessor before the parser. In my case I use fcl-passrc in a code analysis tool that I am building and I would need to detect directives during parsing.  It's possible?  In the PasTree unit I don't see data structures for comments / directives.  Thanks.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Parsing compiler directive with fcl-passrc

Free Pascal - Lazarus mailing list


On Sun, 17 May 2020, Simone Tacconi via lazarus wrote:

> I know that in general, compiler directives are processed by the
> preprocessor before the parser.  In my case I use fcl-passrc in a code
> analysis tool that I am building and I would need to detect directives
> during parsing.  It's possible?  In the PasTree unit I don't see data
> structures for comments / directives.  Thanks.

No, it is currently not possible.

There is already a hook for comments.

We could additionally provide a hook that is called whenever a directive
is encountered. Then you can create your own structures.

Michael.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Parsing compiler directive with fcl-passrc

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sun, 17 May 2020 12:43:41 +0200
Simone Tacconi via lazarus <[hidden email]> wrote:

> I know that in general, compiler directives are processed by the
> preprocessor before the parser. In my case I use fcl-passrc in a code
> analysis tool that I am building and I would need to detect
> directives during parsing.  It's possible?  In the PasTree unit I
> don't see data structures for comments / directives.  Thanks.

You can override TPascalScanner.HandleDirective

Mattias
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus