Up to [cvs.NetBSD.org] / src / usr.bin / indent
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
indent: switch to standard code style Taken from share/misc/indent.pro. Indent does not wrap code to fit into the line width, it only does so for comments. The 'INDENT OFF' sections and too long lines will be addressed in a follow-up commit. No functional change.
indent: allow comments in column 1 to be formatted
indent: clean up local indentation profile The -eei option now works, the type hints are no longer necessary.
indent: let indent format its own code With manual corrections, as indent does not properly indent multi-line '?:' expressions nor multi-line controlling expressions.
indent: run indent on its own source code With manual corrections afterwards, to compensate for the remaining bugs in indent. Without the type definitions in .indent.pro, the opening braces of the functions kw_name and lexi_alnum would not be at the beginning of the line.
indent: run indent on lexi.c, with manual corrections The variables 'keywords' and 'typenames' were indented using 8 spaces, even though -di0 was in effect, which should result in a single space, and -ut was in effect, which should result in a single tab instead of 8 spaces. The option -eei does not work as advertised, the controlling expressions are only indented by the normal amount, which easily leads to confusion as to whether the code belongs to the condition or the following statement.
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.