Author Topic: fcl-passrc and preprocessing  (Read 1319 times)


  • Newbie
  • Posts: 1
fcl-passrc and preprocessing
« on: October 07, 2023, 04:00:23 pm »
It seems that fcl-passrc implements preprocessing for directives like $ifdef $if $elif $else.. $endif
However, I would like to have a way to define custom symbols inside the following function:

function ParseSource(AEngine: TPasTreeContainer;
                     const FPCCommandLine : Array of String;
                     OSTarget, CPUTarget: String;
                     Options : TParseSourceOptions): TPasModule;     

Any code example for this?
« Last Edit: October 07, 2023, 04:12:54 pm by steve64 »


  • Hero Member
  • *****
  • Posts: 568
Re: fcl-passrc and preprocessing
« Reply #1 on: October 08, 2023, 04:36:13 pm »
I've used fcl-passrc extensively in the past, not recently. Therefore my knowledge is not fresh and I would need to re-read my old code.

However, hoping to be useful anyway, I believe you have to use the TPascalScanner.AddDefine method, related to the scanner associated with the parser.

If you take a look at the library code you have usage examples:
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64


TinyPortal © 2005-2018