Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-05

Parsing compiler directive with fcl-passrc

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Simone Tacconi

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. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200517/2be5d145/attachment.html>

Reply by email

Michael Van Canneyt
Simone Tacconi wrote 5 lines
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.

Reply by email

Mattias Gaertner
Show quoted text 5 lines
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

Reply by email