neslib / Chet

C Header Translator for Delphi
BSD 2-Clause "Simplified" License
204 stars 43 forks source link

Chet does not translate "postfix" comments in a desirable way #10

Closed Akira13641 closed 2 years ago

Akira13641 commented 3 years ago

Oftentimes, C and C++ headers containing data type declarations (structs, enums, and so on) will have line-by-line comments that follow the field they're documenting, as opposed to preceding it. For example:

typedef struct S {
  int A; /** Integral value */
  char* C; /** String value */
  float Y; /** Floating-point value */
} S;

When passed that code, Chet currently produces the following:

  S = record
    A: Integer;
    (* Integral value *)
    C: PUTF8Char;
    (* String value *)
    Y: Single;
  end;

which of course when run through Pasdoc will have no comment associated with the A field at all, and comments that are actually intended for the previous field for C and Y.

I'm aware that this perhaps might be somewhat difficult to implement, but it would certainly be a welcome bit of added functionality if there is any way to pull it off.

neslib commented 2 years ago

Unfortunately, the Clang backend used to parse the C code does not support extracting postfix comments in this way. Until they do, I don't see a way to fix this. Once Clang supports this, I will be happy to take a look at it. Closing this issue until then.