Recent

Documentation Board

Please put documentation mutations, enhancements and errors in GitLab bugtracker, this group is for documenters  to talk over documentation and its tools.

Author Topic: FPDoc error when parsing LazUtils source code  (Read 510 times)

dsiders

  • Hero Member
  • *****
  • Posts: 1491
FPDoc error when parsing LazUtils source code
« on: November 19, 2025, 02:33:36 am »
I have stumbled into an issue with FPDoc where it complains about a class when building docs. It aborts processing the unit, and as a result there is no docs generated for the unit. The source compiles fine - so the compiler is not complaining - just the parsing code in FPDoc. I have tested both the 3.2.2 and 3.3.1 (17-Oct-2025) versions of FPDoc. Both have the same issue. The offending code is:

Code: Bash  [Select][+][-]
  1. components/lazutils/lazlistclasses.pas (228,15): Expected "=" at token "Identifier TCapacityAccessor"
  2. in file components/lazutils/lazlistclasses.pas at line 228 column 15
  3.  

Code: Pascal  [Select][+][-]
  1. TCAWrap = class
  2.   public type
  3.     generic TCapacityAccessor<TMemHeaderT; TData> = object  // <<< ERROR here
  4.   public
  5.     class function ReadCapacity(const AMem: Pointer): Cardinal; inline; static;
  6.     class function ReadCapacitySafe(const AMem: Pointer): Cardinal; inline; static;
  7.     class procedure WriteCapacity(const AMem: Pointer; AValue: Cardinal); inline; static;
  8.   end;
  9. end;
  10.  

Should I just report this as a FPC utilities bug, or am I missing something?


« Last Edit: November 19, 2025, 02:37:52 am by dsiders »
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11901
  • Debugger - SynEdit - and more
    • wiki
Re: FPDoc error when parsing LazUtils source code
« Reply #1 on: November 19, 2025, 10:04:41 am »
Good question, don't know if the compiler should accept that. The ; normally comes (must come) after a type constraint, if one is used.

The ; in the param list could (probably should) be replaced by a , instead.

I might do that (but right now, I already have 3 IDE instances running / so later, if I remember)



PascalDragon

  • Hero Member
  • *****
  • Posts: 6229
  • Compiler Developer
Re: FPDoc error when parsing LazUtils source code
« Reply #2 on: November 20, 2025, 10:27:33 pm »
Good question, don't know if the compiler should accept that. The ; normally comes (must come) after a type constraint, if one is used.

In generic the semicolon is mainly used when different types are denoted, especially when type constraints are involved:

Code: Pascal  [Select][+][-]
  1. TGenType<T: TSomeClass; S, R: TSomeOtherClass>

It is allowed to use it as separator without type constraints, just not common.

dsiders

  • Hero Member
  • *****
  • Posts: 1491
Re: FPDoc error when parsing LazUtils source code
« Reply #3 on: November 24, 2025, 02:53:46 pm »
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

dsiders

  • Hero Member
  • *****
  • Posts: 1491
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11901
  • Debugger - SynEdit - and more
    • wiki
Re: FPDoc error when parsing LazUtils source code
« Reply #5 on: November 24, 2025, 03:46:09 pm »
Well, its inside the class for a reason. It wont work outside...

But I found the time to change it to a comma.

Don't know if that is enough, but if FpDoc still fails then it needs to be fixed in FpDoc
« Last Edit: November 24, 2025, 03:47:43 pm by Martin_fr »

dsiders

  • Hero Member
  • *****
  • Posts: 1491
Re: FPDoc error when parsing LazUtils source code
« Reply #6 on: November 24, 2025, 04:35:50 pm »
Well, its inside the class for a reason. It wont work outside...

But I found the time to change it to a comma.

Don't know if that is enough, but if FpDoc still fails then it needs to be fixed in FpDoc

I tried building Docs after the change. The error remains. It's the nested syntax, apparently.

I agree that it needs to be fixed. Probably in the fcl-passrc code which FPDoc relies upon.

For the time being LazListClasses.pas and LazListCLassesBase.pas will not have docs in new builds.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

 

TinyPortal © 2005-2018