[fpc-pascal] FPC coding standards
Dwight Schauer
das at teegra.net
Wed Aug 19 00:27:49 CEST 2020
On Tue, 2020-08-18 at 23:17 +0200, Marco van de Voort via fpc-pascal
wrote:
> Op 2020-08-18 om 23:01 schreef Sven Barth via fpc-pascal:
> > Might be the even better solution as fcl-passrc will be better
> > maintained due to it being used for both the documentation utility
> > fpdoc as well as pas2js.
> >
> Parsers for compilers or source transformation usually discard
> whitespace asap, while editor and formatting parsers don't. Usually
> they
> are different beasts.
The only signifiicant whitespace I'm concerned about is that found in
string literals and in comments. Other whitespace or manual formatting
does not really apply to any strict standard style conformance. I'm not
looking for something that honors personal tweaking here and there.
As far as whitespace in literal strings, I'm sure those don't get
mangled for pas2js (other than maybe the escaped characters changing,
but the transformed string is still going to be an equivalent one).
Now I've seen formatters for other languages, Go for instance, that
sort imports and removes ones that are not referenced.
I'm not looking to set up something that invasive. I just want
something that I have a few sets of configs that I'm able to tweak
make the code adhere to different standards or formatting style. And
have one for the style I prefer, but if I need something to be in
someone else's style, no problem. (Which I can currently do with clang-
tidy).
clang-tidy in my experience for C/C++ seems to throw away all your
whitespace, and reformat according the standard you have chose (which
you can tweak). With some exception though as far "all whitespace".
As long as the code only gets alterned into something logically
equivalaent, and as long as I can retreive the contents of comments
formatted as they were originally, I'm not concerned. (Other than
enforcing so many so many spaces after something like // and before it,
lining up // on adjacent lines in a configurable manner, etc.)
Sincerely,
Dwight
More information about the fpc-pascal
mailing list