indent: add .indent.pro that almost matches the source code

One might expect that the code of indent is properly indented according
to its own capabilities, but that's not the case, there are many
deviations.

This indentation profile comes close to the existing code. Maybe someday
indent's own source code can be formatted using this profile, but before
attempting that, its remaining bugs have to be fixed.

Development of indent has essentially stopped somewhere around 1990, as
demonstrated by the wrong formatting of '...' that has only been fixed a
few minutes ago. The '...' is an invention of C90. Indent's parser still
considers '...' as consisting of the 3 tokens period-period-period, but
that's OK since the effect is the same.

Another feature that had been missing for a long time were C99 comments
that span from '//' to the next newline. Before March 2021, these were
parsed as a binary operator, which produced lots of funny side effects.

Since indent's code makes use of several C99 features, as soon as it can
properly indent its own code, the worst of these bugs will have been
fixed.
This commit is contained in:
rillig 2021-09-26 19:02:35 +00:00
parent d8766f5ac3
commit 16cc73a865
1 changed files with 10 additions and 0 deletions

10
usr.bin/indent/.indent.pro vendored Normal file
View File

@ -0,0 +1,10 @@
/* $NetBSD: .indent.pro,v 1.1 2021/09/26 19:02:35 rillig Exp $ */
-di0 /* Do not indent variable names in global declarations. */
-nfc1 /* Do not format CVS Id comments. */
-i4 /* Indent by 4 spaces, for traditional reasons. */
-ldi0 /* Do not indent variable names in local declarations. */
-nlp /* Do not indent function arguments. */
-ta /* Identifiers ending in '_t' are considered type names. */
-TFILE /* Additional types, for proper formatting of '*'. */
-Ttoken_type