Up to [cvs.NetBSD.org] / src / usr.bin / indent
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.207 / (download) - annotate - [select for diffs], Sun Dec 3 21:44:42 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.206: +1 -7
lines
Diff to previous 1.206 (colored) to selected 1.5 (colored)
indent: inline input-related macros No binary change.
Revision 1.206 / (download) - annotate - [select for diffs], Sun Dec 3 21:40:44 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.205: +18 -10
lines
Diff to previous 1.205 (colored) to selected 1.5 (colored)
indent: group input-related variables into a struct No functional change.
Revision 1.205 / (download) - annotate - [select for diffs], Sun Dec 3 21:03:58 2023 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.204: +3 -2
lines
Diff to previous 1.204 (colored) to selected 1.5 (colored)
indent: use line number of the token start in diagnostics Previously, the line number of the end of the token was used, which was confusing in debug mode.
Revision 1.204 / (download) - annotate - [select for diffs], Mon Jun 26 20:03:09 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.203: +15 -1
lines
Diff to previous 1.203 (colored) to selected 1.5 (colored)
indent: implement 'blank line above first statement in function body'
Revision 1.203 / (download) - annotate - [select for diffs], Fri Jun 23 20:43:21 2023 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.202: +5 -1
lines
Diff to previous 1.202 (colored) to selected 1.5 (colored)
indent: properly store parser state in debug mode The stacks in the parser state are allocated now and need to be copied individually. The test whether two paren stacks are equal was broken since 2023-06-14 14:11:28.
Revision 1.202 / (download) - annotate - [select for diffs], Fri Jun 16 23:51:32 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.201: +2 -3
lines
Diff to previous 1.201 (colored) to selected 1.5 (colored)
indent: merge lexer symbols for type in/outside parentheses
Revision 1.201 / (download) - annotate - [select for diffs], Fri Jun 16 12:30:45 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.200: +2 -1
lines
Diff to previous 1.200 (colored) to selected 1.5 (colored)
indent: fix indentation and linebreaks in typedef declarations
Revision 1.200 / (download) - annotate - [select for diffs], Fri Jun 16 11:48:32 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.199: +4 -3
lines
Diff to previous 1.199 (colored) to selected 1.5 (colored)
indent: don't force a blank line between '}' and preprocessing line
Revision 1.199 / (download) - annotate - [select for diffs], Fri Jun 16 11:27:49 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.198: +3 -3
lines
Diff to previous 1.198 (colored) to selected 1.5 (colored)
indent: rename a field of the parser state The previous name 'comment_in_first_line' was misleading, as it could mean that there was a comment in the first line of the file. No functional change.
Revision 1.198 / (download) - annotate - [select for diffs], Thu Jun 15 10:59:06 2023 UTC (9 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.197: +2 -2
lines
Diff to previous 1.197 (colored) to selected 1.5 (colored)
indent: rename state variable to be more accurate No binary change.
Revision 1.197 / (download) - annotate - [select for diffs], Wed Jun 14 20:46:08 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.196: +8 -8
lines
Diff to previous 1.196 (colored) to selected 1.5 (colored)
indent: clean up the code, add a few tests
Revision 1.196 / (download) - annotate - [select for diffs], Wed Jun 14 19:05:40 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.195: +5 -5
lines
Diff to previous 1.195 (colored) to selected 1.5 (colored)
indent: allow more than 128 brace levels
Revision 1.195 / (download) - annotate - [select for diffs], Wed Jun 14 16:14:30 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.194: +5 -2
lines
Diff to previous 1.194 (colored) to selected 1.5 (colored)
indent: clean up array indexing for parser symbols With 'top' pointing to the actual top element, the array was indexed in the closed range from 0 to top. All other arrays are indexed by the usual half-open interval from 0 to len. No functional change.
Revision 1.194 / (download) - annotate - [select for diffs], Wed Jun 14 14:11:28 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.193: +9 -6
lines
Diff to previous 1.193 (colored) to selected 1.5 (colored)
indent: allow more than 20 nested parentheses or brackets
Revision 1.193 / (download) - annotate - [select for diffs], Wed Jun 14 09:57:02 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.192: +3 -3
lines
Diff to previous 1.192 (colored) to selected 1.5 (colored)
indent: clean up debugging code
Revision 1.192 / (download) - annotate - [select for diffs], Wed Jun 14 09:31:05 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.191: +9 -12
lines
Diff to previous 1.191 (colored) to selected 1.5 (colored)
indent: clean up handling of comments One less moving part in the parser state. No functional change.
Revision 1.191 / (download) - annotate - [select for diffs], Wed Jun 14 08:36:51 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.190: +1 -6
lines
Diff to previous 1.190 (colored) to selected 1.5 (colored)
indent: remove another flag from parser state When processing a comment, the flag ps.next_col_1 was not used for the next token, but for a line within a comment. As its scope was limited to a single comment, there is no need to store it any longer than that No functional change.
Revision 1.190 / (download) - annotate - [select for diffs], Wed Jun 14 08:25:15 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.189: +3 -4
lines
Diff to previous 1.189 (colored) to selected 1.5 (colored)
indent: remove a redundant flag from the parser state No functional change.
Revision 1.189 / (download) - annotate - [select for diffs], Wed Jun 14 07:20:55 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.188: +1 -2
lines
Diff to previous 1.188 (colored) to selected 1.5 (colored)
indent: merge parser symbols for stmt and stmt_list They were handled in exactly the same way.
Revision 1.188 / (download) - annotate - [select for diffs], Sat Jun 10 21:36:38 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.187: +4 -5
lines
Diff to previous 1.187 (colored) to selected 1.5 (colored)
indent: rename misleading variable The name started with 'line_start', but the value is not always the value from the beginning of the line. No functional change.
Revision 1.187 / (download) - annotate - [select for diffs], Sat Jun 10 16:43:56 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.186: +25 -26
lines
Diff to previous 1.186 (colored) to selected 1.5 (colored)
indent: miscellaneous cleanups
Revision 1.186 / (download) - annotate - [select for diffs], Sat Jun 10 12:59:31 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.185: +15 -2
lines
Diff to previous 1.185 (colored) to selected 1.5 (colored)
indent: in debug mode, null-terminate buffers
Revision 1.185 / (download) - annotate - [select for diffs], Sat Jun 10 07:42:41 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.184: +3 -4
lines
Diff to previous 1.184 (colored) to selected 1.5 (colored)
indent: clean up function and variable names
Revision 1.184 / (download) - annotate - [select for diffs], Sat Jun 10 06:38:21 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.183: +26 -26
lines
Diff to previous 1.183 (colored) to selected 1.5 (colored)
indent: rename and sort variables in parser state No functional change.
Revision 1.183 / (download) - annotate - [select for diffs], Fri Jun 9 22:01:26 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.182: +2 -1
lines
Diff to previous 1.182 (colored) to selected 1.5 (colored)
indent: trim trailing blank lines
Revision 1.182 / (download) - annotate - [select for diffs], Fri Jun 9 16:23:43 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.181: +16 -12
lines
Diff to previous 1.181 (colored) to selected 1.5 (colored)
indent: group lexer symbols by topic, sort processing functions No functional change.
Revision 1.181 / (download) - annotate - [select for diffs], Fri Jun 9 10:24:55 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.180: +2 -1
lines
Diff to previous 1.180 (colored) to selected 1.5 (colored)
indent: don't treat function call expressions as cast expressions
Revision 1.180 / (download) - annotate - [select for diffs], Fri Jun 9 08:10:58 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.179: +2 -2
lines
Diff to previous 1.179 (colored) to selected 1.5 (colored)
indent: when an indentation is ambiguous, indent one level further The '-eei' mode now applies whenever the indentation from a multi-line expression could be confused with a following statement.
Revision 1.179 / (download) - annotate - [select for diffs], Thu Jun 8 21:18:54 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.178: +1 -9
lines
Diff to previous 1.178 (colored) to selected 1.5 (colored)
indent: remove fragile heuristic for detecting cast expressions The assumption that in an expression of the form '(a * anything)', the '*' marks a pointer type was too simple-minded. For now, fix the obvious cases and leave the others for later. If needed, they can be worked around using the '-T' option.
Revision 1.178 / (download) - annotate - [select for diffs], Thu Jun 8 06:47:13 2023 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.177: +5 -6
lines
Diff to previous 1.177 (colored) to selected 1.5 (colored)
indent: clean up and condense code No functional change.
Revision 1.177 / (download) - annotate - [select for diffs], Wed Jun 7 15:46:12 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.176: +8 -4
lines
Diff to previous 1.176 (colored) to selected 1.5 (colored)
indent: extract the stack of parser symbols to a separate struct No functional change.
Revision 1.176 / (download) - annotate - [select for diffs], Tue Jun 6 04:37:26 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.175: +1 -4
lines
Diff to previous 1.175 (colored) to selected 1.5 (colored)
indent: compute indentation of 'case' labels on-demand One less moving part to keep track of. No functional change.
Revision 1.175 / (download) - annotate - [select for diffs], Mon Jun 5 14:22:26 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.174: +2 -2
lines
Diff to previous 1.174 (colored) to selected 1.5 (colored)
indent: sync debug output with parser state
Revision 1.174 / (download) - annotate - [select for diffs], Mon Jun 5 12:05:01 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.173: +11 -11
lines
Diff to previous 1.173 (colored) to selected 1.5 (colored)
indent: format own source code
Revision 1.173 / (download) - annotate - [select for diffs], Mon Jun 5 10:12:21 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.172: +2 -3
lines
Diff to previous 1.172 (colored) to selected 1.5 (colored)
indent: do not report broken lines, report configuration on stderr
Revision 1.172 / (download) - annotate - [select for diffs], Mon Jun 5 07:35:05 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.171: +9 -11
lines
Diff to previous 1.171 (colored) to selected 1.5 (colored)
indent: rename variables, clean up comments No binary change.
Revision 1.171 / (download) - annotate - [select for diffs], Sun Jun 4 20:51:19 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.170: +5 -5
lines
Diff to previous 1.170 (colored) to selected 1.5 (colored)
indent: remove read pointer from buffers that don't need it The only buffer that needs a read pointer is the current input line in 'inp'. No functional change.
Revision 1.170 / (download) - annotate - [select for diffs], Sun Jun 4 17:54:11 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.169: +7 -9
lines
Diff to previous 1.169 (colored) to selected 1.5 (colored)
indent: track the kind of '{' on the parser stack
Revision 1.169 / (download) - annotate - [select for diffs], Sun Jun 4 17:02:06 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.168: +7 -3
lines
Diff to previous 1.168 (colored) to selected 1.5 (colored)
indent: fix debug output of the parser symbol stack Even though the stack always contains a stmt_list as first element, print it nevertheless to avoid confusion about starting at index 1, and to provide the full picture.
Revision 1.168 / (download) - annotate - [select for diffs], Sun Jun 4 14:20:00 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.167: +3 -4
lines
Diff to previous 1.167 (colored) to selected 1.5 (colored)
indent: rename struct field, for better symmetry No binary change outside debug mode.
Revision 1.167 / (download) - annotate - [select for diffs], Sun Jun 4 12:46:57 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.166: +7 -6
lines
Diff to previous 1.166 (colored) to selected 1.5 (colored)
lint: use separate lexer symbols for 'case' and 'default' It's not strictly necessary since these tokens behave in the same way, still, the code is more straight-forward when there are separate tokens.
Revision 1.166 / (download) - annotate - [select for diffs], Sun Jun 4 11:45:00 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.165: +2 -2
lines
Diff to previous 1.165 (colored) to selected 1.5 (colored)
indent: classify 'inline' as a modifier rather than a word
Revision 1.165 / (download) - annotate - [select for diffs], Sun Jun 4 11:33:36 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.164: +7 -2
lines
Diff to previous 1.164 (colored) to selected 1.5 (colored)
indent: use separate lexer symbols for the different kinds of ':'
Revision 1.164 / (download) - annotate - [select for diffs], Sun Jun 4 11:09:18 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.163: +2 -3
lines
Diff to previous 1.163 (colored) to selected 1.5 (colored)
indent: handle the indentation of 'case' in a simpler way
Revision 1.163 / (download) - annotate - [select for diffs], Sun Jun 4 10:23:36 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.162: +5 -3
lines
Diff to previous 1.162 (colored) to selected 1.5 (colored)
indent: separate code for handling parentheses and brackets Handling parentheses is more complicated than for brackets.
Revision 1.162 / (download) - annotate - [select for diffs], Fri Jun 2 14:21:55 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.161: +4 -4
lines
Diff to previous 1.161 (colored) to selected 1.5 (colored)
indent: improve heuristics of classifying '*' as pointer or operator
Revision 1.161 / (download) - annotate - [select for diffs], Fri Jun 2 13:59:33 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.160: +3 -1
lines
Diff to previous 1.160 (colored) to selected 1.5 (colored)
indent: clean up Only print the 'token' buffer in debug mode if it is interesting, group the blocks in handling of '(' tokens by topic, remove obsolete comment from test.
Revision 1.160 / (download) - annotate - [select for diffs], Fri Jun 2 11:43:07 2023 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.159: +4 -3
lines
Diff to previous 1.159 (colored) to selected 1.5 (colored)
indent: fix formatting of declarations with preprocessing lines
Revision 1.159 / (download) - annotate - [select for diffs], Tue May 23 12:12:29 2023 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.158: +5 -3
lines
Diff to previous 1.158 (colored) to selected 1.5 (colored)
indent: split debug output into paragraphs The paragraphs separate the different processing steps: getting a token from the lexer, processing the token, updating the parser state, sending a finished line to the output.
Revision 1.158 / (download) - annotate - [select for diffs], Tue May 23 06:35:01 2023 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.157: +9 -1
lines
Diff to previous 1.157 (colored) to selected 1.5 (colored)
indent: fix spacing in declarations in for loops
Revision 1.157 / (download) - annotate - [select for diffs], Mon May 22 10:28:59 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.156: +11 -5
lines
Diff to previous 1.156 (colored) to selected 1.5 (colored)
indent: implement suppressing optional blank lines
Revision 1.156 / (download) - annotate - [select for diffs], Sat May 20 11:53:53 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.155: +16 -8
lines
Diff to previous 1.155 (colored) to selected 1.5 (colored)
indent: extract the output state from the parser state The parser state depends on the preprocessing lines, the output state shouldn't.
Revision 1.155 / (download) - annotate - [select for diffs], Sat May 20 11:19:17 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.154: +2 -1
lines
Diff to previous 1.154 (colored) to selected 1.5 (colored)
indent: implement blank line above block comment
Revision 1.154 / (download) - annotate - [select for diffs], Sat May 20 10:46:21 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.153: +5 -3
lines
Diff to previous 1.153 (colored) to selected 1.5 (colored)
indent: implement blank line after function body
Revision 1.153 / (download) - annotate - [select for diffs], Sat May 20 10:09:02 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.152: +9 -2
lines
Diff to previous 1.152 (colored) to selected 1.5 (colored)
indent: implement blank lines around conditional compilation
Revision 1.152 / (download) - annotate - [select for diffs], Sat May 20 02:47:35 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.151: +2 -2
lines
Diff to previous 1.151 (colored) to selected 1.5 (colored)
indent: add debug logging for brace indentation No functional change outside debug mode, as the initialization of di_stack[0] was redundant.
Revision 1.151 / (download) - annotate - [select for diffs], Sat May 20 00:17:56 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.150: +8 -2
lines
Diff to previous 1.150 (colored) to selected 1.5 (colored)
indent: separate detection of function definitions from lexing '*' No functional change.
Revision 1.150 / (download) - annotate - [select for diffs], Thu May 18 08:09:28 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.149: +2 -2
lines
Diff to previous 1.149 (colored) to selected 1.5 (colored)
indent: document the funcname token
Revision 1.149 / (download) - annotate - [select for diffs], Thu May 18 06:01:39 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.148: +2 -2
lines
Diff to previous 1.148 (colored) to selected 1.5 (colored)
indent: rename a few functions No functional change.
Revision 1.148 / (download) - annotate - [select for diffs], Thu May 18 04:23:03 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.147: +201 -196
lines
Diff to previous 1.147 (colored) to selected 1.5 (colored)
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.
Revision 1.147 / (download) - annotate - [select for diffs], Thu May 18 03:38:34 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.146: +2 -2
lines
Diff to previous 1.146 (colored) to selected 1.5 (colored)
indent: remove unnecessary variable size optimization Due to the enum that follows in the struct, the short variable was padded to 4 bytes anyway. No functional change.
Revision 1.146 / (download) - annotate - [select for diffs], Tue May 16 13:26:26 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.145: +10 -5
lines
Diff to previous 1.145 (colored) to selected 1.5 (colored)
indent: directly access the input buffer No functional change.
Revision 1.145 / (download) - annotate - [select for diffs], Tue May 16 11:32:01 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.144: +1 -2
lines
Diff to previous 1.144 (colored) to selected 1.5 (colored)
indent: remove support for form feed characters inside a line Form feeds are occasionally used to split code into pages, and this use is still supported. Having a form feed in the middle of a line is exotic.
Revision 1.144 / (download) - annotate - [select for diffs], Tue May 16 08:04:03 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.143: +7 -3
lines
Diff to previous 1.143 (colored) to selected 1.5 (colored)
indent: fix handling of INDENT OFF/ON comments Previously, the 'INDENT OFF' comments were interpreted when the newline token from the line above the comment was processed, which was earlier than could be reasonably expected. The 'INDENT ON' comments were interpreted equally early, which led to the situation that the 'INDENT OFF' comments were preserved literally but the 'INDENT ON' comments weren't.
Revision 1.143 / (download) - annotate - [select for diffs], Tue May 16 07:13:05 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.142: +2 -1
lines
Diff to previous 1.142 (colored) to selected 1.5 (colored)
indent: move parsing of 'INDENT OFF/ON' comments to the lexer No functional change.
Revision 1.142 / (download) - annotate - [select for diffs], Mon May 15 22:52:21 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.141: +7 -5
lines
Diff to previous 1.141 (colored) to selected 1.5 (colored)
indent: clean up detection of whether parentheses form a cast No functional change.
Revision 1.141 / (download) - annotate - [select for diffs], Mon May 15 20:30:20 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.140: +3 -3
lines
Diff to previous 1.140 (colored) to selected 1.5 (colored)
indent: fix duplicate space between comment and binary operator
Revision 1.140 / (download) - annotate - [select for diffs], Mon May 15 20:12:28 2023 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.139: +13 -9
lines
Diff to previous 1.139 (colored) to selected 1.5 (colored)
indent: format its own code, extend some comments With manual corrections, as there are still some bugs left. No functional change.
Revision 1.139 / (download) - annotate - [select for diffs], Mon May 15 13:33:19 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.138: +6 -2
lines
Diff to previous 1.138 (colored) to selected 1.5 (colored)
indent: fix indentation of statements after controlling expression
Revision 1.138 / (download) - annotate - [select for diffs], Mon May 15 12:59:43 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.137: +3 -1
lines
Diff to previous 1.137 (colored) to selected 1.5 (colored)
indent: fix indentation of expressions in -nlp -eei mode
Revision 1.137 / (download) - annotate - [select for diffs], Mon May 15 10:13:40 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.136: +4 -4
lines
Diff to previous 1.136 (colored) to selected 1.5 (colored)
indent: fix indentation of multi-line '?:' expressions in functions
Revision 1.136 / (download) - annotate - [select for diffs], Mon May 15 09:53:32 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.135: +72 -65
lines
Diff to previous 1.135 (colored) to selected 1.5 (colored)
indent: group parser state by topic No functional change.
Revision 1.135 / (download) - annotate - [select for diffs], Mon May 15 08:02:01 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.134: +2 -3
lines
Diff to previous 1.134 (colored) to selected 1.5 (colored)
indent: clean up memory allocation No functional change.
Revision 1.134 / (download) - annotate - [select for diffs], Mon May 15 07:57:22 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.133: +2 -2
lines
Diff to previous 1.133 (colored) to selected 1.5 (colored)
indent: move debugging code to separate file No functional change.
Revision 1.133 / (download) - annotate - [select for diffs], Mon May 15 07:28:45 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.132: +8 -12
lines
Diff to previous 1.132 (colored) to selected 1.5 (colored)
indent: clean up memory and buffer management Remove the need to explicitly initialize the buffers. To avoid subtracting null pointers or comparing them using '<', migrate the buffers from the (start, end) form to the (start, len) form. This form also avoids inconsistencies in whether 'buf.e == buf.s' or 'buf.s == buf.e' is used. Make buffer.st const, to avoid accidental modification of the buffer's content. Replace '*buf.e++ = ch' with buf_add_char, to avoid having to keep track how much unwritten space is left in the buffer. Remove all safety margins, that is, no more unchecked access to buf.st[-1] or appending using '*buf.e++'. Fix line number counting in lex_word for words that contain line breaks. No functional change.
Revision 1.132 / (download) - annotate - [select for diffs], Sun May 14 22:26:37 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.131: +2 -2
lines
Diff to previous 1.131 (colored) to selected 1.5 (colored)
indent: only null-terminate the buffers if necessary The only case where a buffer is used as a C-style string is when looking up a keyword. No functional change.
Revision 1.131 / (download) - annotate - [select for diffs], Sun May 14 14:14:07 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.130: +1 -2
lines
Diff to previous 1.130 (colored) to selected 1.5 (colored)
indent: reduce code for scanning tokens The input line is guaranteed to end with '\n', so there's no need to carry another pointer around. No functional change.
Revision 1.130 / (download) - annotate - [select for diffs], Sun May 14 12:12:02 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.129: +1 -5
lines
Diff to previous 1.129 (colored) to selected 1.5 (colored)
indent: remove foreign RCS IDs
Revision 1.129 / (download) - annotate - [select for diffs], Sun May 14 11:29:23 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.128: +30 -18
lines
Diff to previous 1.128 (colored) to selected 1.5 (colored)
indent: miscellaneous cleanups
Revision 1.128 / (download) - annotate - [select for diffs], Sat May 13 15:34:22 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.127: +4 -1
lines
Diff to previous 1.127 (colored) to selected 1.5 (colored)
indent: implement 'blank after declarations'
Revision 1.127 / (download) - annotate - [select for diffs], Sat May 13 14:30:48 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.126: +6 -2
lines
Diff to previous 1.126 (colored) to selected 1.5 (colored)
indent: use enum instead of magic numbers for tracking declarations No functional change.
Revision 1.126 / (download) - annotate - [select for diffs], Sat May 13 13:48:54 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.125: +4 -4
lines
Diff to previous 1.125 (colored) to selected 1.5 (colored)
indent: improve names of option variables No functional change.
Revision 1.125 / (download) - annotate - [select for diffs], Sat May 13 12:31:02 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.124: +3 -3
lines
Diff to previous 1.124 (colored) to selected 1.5 (colored)
indent: rename struct fields for buffers No binary change except for assertion line numbers.
Revision 1.124 / (download) - annotate - [select for diffs], Sat May 13 09:40:47 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.123: +6 -5
lines
Diff to previous 1.123 (colored) to selected 1.5 (colored)
indent: clean up a condition, add comments No functional change.
Revision 1.123 / (download) - annotate - [select for diffs], Sat May 13 09:27:49 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.122: +15 -7
lines
Diff to previous 1.122 (colored) to selected 1.5 (colored)
indent: move debugging code to separate file No functional change.
Revision 1.122 / (download) - annotate - [select for diffs], Fri May 12 22:38:47 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.121: +3 -3
lines
Diff to previous 1.121 (colored) to selected 1.5 (colored)
indent: rename placeholder symbol for parser stack No functional change outside debug mode.
Revision 1.121 / (download) - annotate - [select for diffs], Fri May 12 10:53:33 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.120: +1 -8
lines
Diff to previous 1.120 (colored) to selected 1.5 (colored)
indent: remove statistics The numbers from the statistics were wrong.
Revision 1.120 / (download) - annotate - [select for diffs], Fri May 12 08:40:54 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.119: +8 -18
lines
Diff to previous 1.119 (colored) to selected 1.5 (colored)
indent: condense code for handling spaced expressions No functional change outside debug mode.
Revision 1.119 / (download) - annotate - [select for diffs], Thu May 11 19:01:35 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.118: +1 -14
lines
Diff to previous 1.118 (colored) to selected 1.5 (colored)
indent: don't touch comments in preprocessing lines The indentation of multi-line comments was wrong, and the code for handling them was too complicated.
Revision 1.118 / (download) - annotate - [select for diffs], Thu May 11 18:26:56 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.117: +1 -7
lines
Diff to previous 1.117 (colored) to selected 1.5 (colored)
indent: remove unused code
Revision 1.117 / (download) - annotate - [select for diffs], Thu May 11 18:13:55 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.116: +1 -8
lines
Diff to previous 1.116 (colored) to selected 1.5 (colored)
indent: remove broken code for handling blank lines This fixes several bugs where blank lines were erroneously added or removed, treating these old bugs for new bugs in different places. These new bugs are expected to be easier to fix, as the old bugs will not interfere anymore.
Revision 1.116 / (download) - annotate - [select for diffs], Thu May 11 17:22:56 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.115: +2 -2
lines
Diff to previous 1.115 (colored) to selected 1.5 (colored)
indent: add debug output for tracking comments and braces
Revision 1.115 / (download) - annotate - [select for diffs], Thu May 11 11:25:47 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.114: +15 -1
lines
Diff to previous 1.114 (colored) to selected 1.5 (colored)
indent: move parser state variables to the parser_state struct Include the variables in the debug output.
Revision 1.114 / (download) - annotate - [select for diffs], Thu May 11 10:51:34 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.113: +5 -1
lines
Diff to previous 1.113 (colored) to selected 1.5 (colored)
indent: move force_nl into the parser state This way, it is included in the debug output. No functional change.
Revision 1.113 / (download) - annotate - [select for diffs], Thu May 11 09:28:53 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.112: +1 -7
lines
Diff to previous 1.112 (colored) to selected 1.5 (colored)
indent: remove buggy code for swapping tokens It is not the job of an indenter to swap tokens, even if it's only about placing comments elsewhere. The code that swapped the tokens was complicated, buggy and impossible to understand. In -br (brace right) mode, indent no longer moves a '{' from the beginning of a line to the end of the previous line, as that was handled by the token swapping code as well. This change is unintended, but it will be easier to re-add that now that the code is simpler.
Revision 1.112 / (download) - annotate - [select for diffs], Sat Apr 23 06:43:22 2022 UTC (23 months ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base,
netbsd-10-0-RC6,
netbsd-10-0-RC5,
netbsd-10-0-RC4,
netbsd-10-0-RC3,
netbsd-10-0-RC2,
netbsd-10-0-RC1,
netbsd-10
Changes since 1.111: +8 -4
lines
Diff to previous 1.111 (colored) to selected 1.5 (colored)
indent: group global variables related to output control No functional change.
Revision 1.111 / (download) - annotate - [select for diffs], Sun Feb 13 12:43:26 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.110: +10 -7
lines
Diff to previous 1.110 (colored) to selected 1.5 (colored)
indent: rename parser_state.p_l_follow and paren_level The previous variable names were misleading. Paren_level is not the current level of parentheses but the one from the beginning of the current output line. For better accuracy, rename it to line_start_paren_level. P_l_follow is not the level of parentheses that will be active at some point in the future, as the previous name suggested. Instead, it is the level of parentheses right now. For better accuracy, rename it to nparen. This nicely matches its main usage, which is as index to the parser_state.paren array. No binary change.
Revision 1.110 / (download) - annotate - [select for diffs], Sun Feb 13 12:20:09 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.109: +13 -11
lines
Diff to previous 1.109 (colored) to selected 1.5 (colored)
indent: replace bitmasking code with struct The struct directly represents the properties of a pair of parentheses, without forcing the human reader to decode any bitset. This makes it easier to find the remaining bugs in the heuristic for determining the kind of parentheses. No functional change outside debug mode.
Revision 1.109 / (download) - annotate - [select for diffs], Sun Feb 13 12:09:19 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.108: +3 -3
lines
Diff to previous 1.108 (colored) to selected 1.5 (colored)
indent: change parser_state.cast_mask to 0-based indexing Having 1-based indexing was completely unexpected, and it didn't match the 0-based indexing of parser_state.paren_indents. No functional change.
Revision 1.108 / (download) - annotate - [select for diffs], Sat Feb 12 19:56:52 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.107: +7 -1
lines
Diff to previous 1.107 (colored) to selected 1.5 (colored)
indent: fix indentation of enum constants in typedef (since 2019-04-04) The solution is not elegant since it adds a small state machine inside the parser state, but at least these states only depend on the sequence of token types and not on any other part of the parser state. Reported in PR#55453.
Revision 1.107 / (download) - annotate - [select for diffs], Sun Nov 28 14:29:03 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.106: +1 -2
lines
Diff to previous 1.106 (colored) to selected 1.5 (colored)
indent: treat L"string" as a single token There is never whitespace between the 'L' and the string literal or the character constant. There might be a backslash-newline between them, but that case was not handled before either. No functional change.
Revision 1.106 / (download) - annotate - [select for diffs], Sun Nov 28 11:49:10 2021 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.105: +2 -2
lines
Diff to previous 1.105 (colored) to selected 1.5 (colored)
indent: clean up and document input handling The transformation of moving comments from after an 'if (expr)' after the following brace has a large implementation cost (about 300 lines of code) and makes input handling quite complicated. Document the overall idea to save future readers some time. No functional change.
Revision 1.105 / (download) - annotate - [select for diffs], Sat Nov 27 21:15:58 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.104: +3 -3
lines
Diff to previous 1.104 (colored) to selected 1.5 (colored)
indent: accept a few formatting suggestions from indent The remaining issues are still that the conditions look ambiguous even with -eei, and that __attribute__ is broken into a separate line. No functional change.
Revision 1.104 / (download) - annotate - [select for diffs], Sat Nov 27 18:37:17 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.103: +3 -3
lines
Diff to previous 1.103 (colored) to selected 1.5 (colored)
indent: rename dump functions to output No functional change.
Revision 1.103 / (download) - annotate - [select for diffs], Fri Nov 26 15:18:18 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.102: +3 -1
lines
Diff to previous 1.102 (colored) to selected 1.5 (colored)
indent: add buf_add_range for adding characters to a buffer No functional change.
Revision 1.102 / (download) - annotate - [select for diffs], Thu Nov 25 18:48:37 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.101: +2 -2
lines
Diff to previous 1.101 (colored) to selected 1.5 (colored)
indent: rename ps.in_function_parameters to match reality This flag is only set while parsing the parameters of a function definition, but not for a function declaration. See buffer_add in the test fmt_decl. No functional change.
Revision 1.101 / (download) - annotate - [select for diffs], Thu Nov 25 07:47:55 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.100: +2 -2
lines
Diff to previous 1.100 (colored) to selected 1.5 (colored)
indent: fix comment for ps.in_decl In C, there are no declaration statements. There are declarations and statements, but no combination thereof.
Revision 1.100 / (download) - annotate - [select for diffs], Thu Nov 25 07:45:32 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.99: +3 -4
lines
Diff to previous 1.99 (colored) to selected 1.5 (colored)
indent: rename ps.in_stmt to in_stmt_or_decl The previous name didn't match reality. No functional change.
Revision 1.99 / (download) - annotate - [select for diffs], Thu Nov 25 07:41:13 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.98: +2 -2
lines
Diff to previous 1.98 (colored) to selected 1.5 (colored)
indent: rename ps.ind_stmt to in_stmt_cont This makes a comment redundant. No functional change.
Revision 1.98 / (download) - annotate - [select for diffs], Fri Nov 19 20:23:17 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.97: +26 -1
lines
Diff to previous 1.97 (colored) to selected 1.5 (colored)
indent: reduce casts to unsigned char for character classification No functional change.
Revision 1.97 / (download) - annotate - [select for diffs], Fri Nov 19 19:55:15 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.96: +2 -5
lines
Diff to previous 1.96 (colored) to selected 1.5 (colored)
indent: replace ps.procname with ps.is_function_definition Omly the first character of ps.procname was ever read, and it was only compared to '\0'. Using a bool for this means simpler code, less memory and fewer wasted CPU cycles due to the removed strncpy. No functional change.
Revision 1.96 / (download) - annotate - [select for diffs], Fri Nov 19 18:25:50 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.95: +1 -15
lines
Diff to previous 1.95 (colored) to selected 1.5 (colored)
indent: unexport inbuf No functional change.
Revision 1.95 / (download) - annotate - [select for diffs], Fri Nov 19 18:23:59 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.94: +2 -1
lines
Diff to previous 1.94 (colored) to selected 1.5 (colored)
indent: use character input API from pr_comment.c No functional change.
Revision 1.94 / (download) - annotate - [select for diffs], Fri Nov 19 18:14:18 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.93: +8 -1
lines
Diff to previous 1.93 (colored) to selected 1.5 (colored)
indent: remove all references to inbuf from indent.c No functional change.
Revision 1.93 / (download) - annotate - [select for diffs], Fri Nov 19 17:59:16 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.92: +4 -1
lines
Diff to previous 1.92 (colored) to selected 1.5 (colored)
indent: move character input handling from indent.c to io.c No functional change.
Revision 1.92 / (download) - annotate - [select for diffs], Fri Nov 19 17:42:45 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.91: +12 -1
lines
Diff to previous 1.91 (colored) to selected 1.5 (colored)
indent: move character input from indent.c to io.c No functional change.
Revision 1.91 / (download) - annotate - [select for diffs], Fri Nov 19 17:30:10 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.90: +3 -1
lines
Diff to previous 1.90 (colored) to selected 1.5 (colored)
indent: use character input API from the tokenizer No functional change.
Revision 1.90 / (download) - annotate - [select for diffs], Fri Nov 19 17:20:57 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.89: +2 -1
lines
Diff to previous 1.89 (colored) to selected 1.5 (colored)
indent: move character input handling from lexi.c to io.c No functional change.
Revision 1.89 / (download) - annotate - [select for diffs], Fri Nov 19 17:11:46 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.88: +3 -1
lines
Diff to previous 1.88 (colored) to selected 1.5 (colored)
indent: replace direct access to the input buffer This is a preparation for abstracting away all the low-level details of handling the input. The goal is to fix the current bugs regarding line number counting, out of bounds memory access, and generally unreadable code. No functional change.
Revision 1.88 / (download) - annotate - [select for diffs], Fri Nov 19 15:32:13 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.87: +5 -8
lines
Diff to previous 1.87 (colored) to selected 1.5 (colored)
indent: rename input buffer variables From reading the names 'save_com' and 'sc_end', it was not obvious enough that these two variables are the limits of the same buffer, the names were just too unrelated. No functional change.
Revision 1.87 / (download) - annotate - [select for diffs], Fri Nov 19 15:28:32 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.86: +15 -14
lines
Diff to previous 1.86 (colored) to selected 1.5 (colored)
indent: group variables for input handling No functional change.
Revision 1.86 / (download) - annotate - [select for diffs], Sun Nov 7 18:26:17 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.85: +15 -7
lines
Diff to previous 1.85 (colored) to selected 1.5 (colored)
indent: various cleanups Make several comments more precise. Rename process_end_of_file to process_eof to match the token name. Change the order of assignments in analyze_comment to keep the com_ind computations closer together. In copy_comment_wrap, use pointer difference instead of pointer addition to stay away from undefined behavior. No functional change.
Revision 1.85 / (download) - annotate - [select for diffs], Sun Nov 7 15:18:25 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.84: +3 -2
lines
Diff to previous 1.84 (colored) to selected 1.5 (colored)
indent: rename ps.decl_nest to decl_level This better matches the comment. No functional change.
Revision 1.84 / (download) - annotate - [select for diffs], Sun Nov 7 14:00:35 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.83: +3 -2
lines
Diff to previous 1.83 (colored) to selected 1.5 (colored)
indent: reduce negations in process_else, clean up comments No functional change.
Revision 1.83 / (download) - annotate - [select for diffs], Sun Nov 7 13:43:11 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.82: +4 -2
lines
Diff to previous 1.82 (colored) to selected 1.5 (colored)
indent: document the comment buffer more accurately
Revision 1.82 / (download) - annotate - [select for diffs], Sun Nov 7 08:24:50 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.81: +3 -2
lines
Diff to previous 1.81 (colored) to selected 1.5 (colored)
indent: split copy_comment into wrapping and non-wrapping These two cases are processed in an almost entirely different way. In particular, copy_comment_nowrap should copy the comment verbatim, which is not obvious from the current code, due to the many conditions and the complex control flow. No functional change.
Revision 1.81 / (download) - annotate - [select for diffs], Sun Nov 7 07:44:59 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.80: +2 -2
lines
Diff to previous 1.80 (colored) to selected 1.5 (colored)
indent: rename type_at_paren_level_0 to type_outside_parentheses For symmetry with type_in_parentheses. No functional change.
Revision 1.80 / (download) - annotate - [select for diffs], Sun Nov 7 07:35:06 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.79: +3 -4
lines
Diff to previous 1.79 (colored) to selected 1.5 (colored)
indent: distinguish between typename in parentheses and other words This gets rid of two members of parser_state. No functional change for well-formed programs. The sequence of '++int' or '--size_t' may be formatted differently than before, but no program is expected to contain that sequence. Rename lsym_ident to lsym_word since 'ident' was too specific. This token type is used for constants and string literals as well. Strictly speaking, a string literal is not a word, but at least it's better than before.
Revision 1.79 / (download) - annotate - [select for diffs], Sun Nov 7 07:06:00 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.78: +4 -4
lines
Diff to previous 1.78 (colored) to selected 1.5 (colored)
indent: rename 'inbuf' functions to 'inp' The variable 'inp' used to be named 'inbuf'. Make the function names correspond to the variable name again. No functional change.
Revision 1.78 / (download) - annotate - [select for diffs], Fri Nov 5 21:39:12 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.77: +3 -2
lines
Diff to previous 1.77 (colored) to selected 1.5 (colored)
indent: the '+ 1' in dump_line_code is not an off-by-one error
Revision 1.77 / (download) - annotate - [select for diffs], Fri Nov 5 19:33:28 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.76: +2 -2
lines
Diff to previous 1.76 (colored) to selected 1.5 (colored)
indent: rename ps.curr_newline to next_col_1 For symmetry with ps.curr_col_1. No functional change.
Revision 1.76 / (download) - annotate - [select for diffs], Wed Nov 3 21:47:35 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.75: +2 -3
lines
Diff to previous 1.75 (colored) to selected 1.5 (colored)
indent: inline indentation_after, shorten function name to ind_add There were only few calls to indentation_after, so inlining it spares the need to look at yet another function definition. Another effect is that code.s and code.e appear in the code as a pair now, instead of a single code.s, making the scope of the function call obvious. In ind_add, there is no need to check for '\0' anymore since none of the buffers can ever contain a null character, these are filtered out by inbuf_read_line. No functional change.
Revision 1.75 / (download) - annotate - [select for diffs], Mon Nov 1 23:44:08 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.74: +2 -1
lines
Diff to previous 1.74 (colored) to selected 1.5 (colored)
indent: fix missing blank after 'return' (since 2021-10-31) In indent.c 1.200 from 2021-10-31, the subtypes of identifier tokens were removed since they were redundant. An unintended side effect was that a parenthesized expression after 'return' was no longer separated by a blank. Before that change, 'return' was tokenized as an lsym_ident with subtype kw_other, and want_space_before_lparen handled this case in the last line. After the change, 'return' was treated as an ordinary identifier, and unless the option '-pcs' (blank after function call) was given, the blank was removed. The other keywords that had kw_other are not affected since they do not expect a '(' afterwards. These keywords are 'break', 'continue', 'goto', 'inline' and 'restrict'. Curiously, there was not a single test case that covered 'return(expr)'. While here, remove the trailing ',' from the enum lexer_symbol, which is not allowed in standard C, it is a GNU extension. Lint doesn't complain about this since the default LINTFLAGS include '-g' for GCC mode.
Revision 1.74 / (download) - annotate - [select for diffs], Sun Oct 31 22:38:12 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.73: +5 -5
lines
Diff to previous 1.73 (colored) to selected 1.5 (colored)
indent: clean up Initialize buffers in reading order, make comments more expressive, rename add_typename to register_typename, remove unused macro. No functional change.
Revision 1.73 / (download) - annotate - [select for diffs], Sun Oct 31 20:40:42 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.72: +3 -10
lines
Diff to previous 1.72 (colored) to selected 1.5 (colored)
indent: replace kw_tag with lsym_tag This leaves only one special type of token, which is lsym_ident, which in some cases represents a type name and in other cases an identifier, constant or string literal. No functional change.
Revision 1.72 / (download) - annotate - [select for diffs], Sun Oct 31 19:57:44 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.71: +2 -14
lines
Diff to previous 1.71 (colored) to selected 1.5 (colored)
indent: replace simple cases of keyword_kind with lexer_symbol The remaining keyword kinds 'tag' and 'type' require a bit more thought, so do them in a separate step. No functional change.
Revision 1.71 / (download) - annotate - [select for diffs], Sun Oct 31 19:20:52 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.70: +2 -2
lines
Diff to previous 1.70 (colored) to selected 1.5 (colored)
indent: rename lsym_type to better reflect reality Type names that occur in parentheses are parsed as lsym_ident having the subtype kw_type instead. No functional change.
Revision 1.70 / (download) - annotate - [select for diffs], Sun Oct 31 10:09:43 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.69: +2 -1
lines
Diff to previous 1.69 (colored) to selected 1.5 (colored)
indent: add separate lexer symbol for offsetof No functional change.
Revision 1.69 / (download) - annotate - [select for diffs], Sun Oct 31 10:00:37 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.68: +2 -1
lines
Diff to previous 1.68 (colored) to selected 1.5 (colored)
indent: add separate lexer symbol for sizeof The plan is to get rid of the type keyword_kind, which largely overlaps with lexer_symbol. No functional change.
Revision 1.68 / (download) - annotate - [select for diffs], Sun Oct 31 09:52:37 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.67: +3 -4
lines
Diff to previous 1.67 (colored) to selected 1.5 (colored)
indent: clean up definition of keywords Rename kw_struct_or_union_or_enum to the shorter kw_tag. Merge kw_jump with kw_inline_or_restrict since they are handled in the same way. No functional change.
Revision 1.67 / (download) - annotate - [select for diffs], Sat Oct 30 22:41:18 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.66: +8 -10
lines
Diff to previous 1.66 (colored) to selected 1.5 (colored)
indent: move debugging functions to a separate section
Revision 1.66 / (download) - annotate - [select for diffs], Sat Oct 30 22:36:07 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.65: +4 -5
lines
Diff to previous 1.65 (colored) to selected 1.5 (colored)
indent: rename prev_newline and prev_col_1 to curr These two flags describe the token that is currently processed. In process_binary_op, curr_newline can never be true since newline is not a binary operator, so remove that condition. No functional change.
Revision 1.65 / (download) - annotate - [select for diffs], Sat Oct 30 22:15:51 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.64: +2 -1
lines
Diff to previous 1.64 (colored) to selected 1.5 (colored)
indent: clean up lexical analyzer Use traditional type for small unsigned numbers instead of uint8_t; the required header was not included. Remove assertion for debug mode; lint takes care of ensuring that the enum constants match the length of the names array. Constify a name array. Move the comparison function for bsearch closer to its caller. No functional change.
Revision 1.64 / (download) - annotate - [select for diffs], Sat Oct 30 11:49:38 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.63: +1 -3
lines
Diff to previous 1.63 (colored) to selected 1.5 (colored)
indent: inline macro label_offset No functional change.
Revision 1.63 / (download) - annotate - [select for diffs], Fri Oct 29 21:56:36 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.62: +3 -2
lines
Diff to previous 1.62 (colored) to selected 1.5 (colored)
indent: fix missing blank before binary operator
Revision 1.62 / (download) - annotate - [select for diffs], Fri Oct 29 20:27:42 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.61: +2 -2
lines
Diff to previous 1.61 (colored) to selected 1.5 (colored)
indent: merge isblank and is_hspace into ch_isblank No functional change.
Revision 1.61 / (download) - annotate - [select for diffs], Fri Oct 29 18:18:03 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.60: +16 -10
lines
Diff to previous 1.60 (colored) to selected 1.5 (colored)
indent: reorder global variables to be more intuitive The buffer 'inp' comes first. From there, a single token is read into the buffer 'token'. From there, it usually ends up in 'code'. The buffer 'token' does not belong to the group of the other 3 buffers, which together make up a line of formatted output. No functional change.
Revision 1.60 / (download) - annotate - [select for diffs], Fri Oct 29 17:50:37 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.59: +8 -7
lines
Diff to previous 1.59 (colored) to selected 1.5 (colored)
indent: use prev/curr/next to refer to the current token The word 'last' just didn't match with 'next'. No functional change.
Revision 1.59 / (download) - annotate - [select for diffs], Fri Oct 29 17:41:56 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.58: +51 -39
lines
Diff to previous 1.58 (colored) to selected 1.5 (colored)
indent: group members of parser_state by topic No functional change.
Revision 1.58 / (download) - annotate - [select for diffs], Fri Oct 29 17:32:22 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.57: +3 -2
lines
Diff to previous 1.57 (colored) to selected 1.5 (colored)
indent: rename ps.dumped_decl_indent and indent_declaration The word 'dump' in 'ps.dumped_decl_indent' was too close to dump_line, which led to confusion since the variable controls whether the indentation has been added to the code buffer, which happens way before actually dumping the current line to the output file. The function name 'indent_declaration' was too unspecific, it did not reveal where the indentation of the declaration actually happened. No functional change.
Revision 1.57 / (download) - annotate - [select for diffs], Fri Oct 29 16:59:35 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.56: +2 -2
lines
Diff to previous 1.56 (colored) to selected 1.5 (colored)
indent: keep p_l_follow nonnegative, use consistent comparison No functional change.
Revision 1.56 / (download) - annotate - [select for diffs], Fri Oct 29 16:54:51 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.55: +8 -7
lines
Diff to previous 1.55 (colored) to selected 1.5 (colored)
indent: spell 'parentheses' properly in messages and comments
Revision 1.55 / (download) - annotate - [select for diffs], Thu Oct 28 22:20:08 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.54: +2 -2
lines
Diff to previous 1.54 (colored) to selected 1.5 (colored)
indent: clean up indentation, comments, reduce No functional change.
Revision 1.54 / (download) - annotate - [select for diffs], Thu Oct 28 21:56:26 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.53: +2 -2
lines
Diff to previous 1.53 (colored) to selected 1.5 (colored)
indent: reduce negations in search_stmt_lookahead No functional change.
Revision 1.53 / (download) - annotate - [select for diffs], Thu Oct 28 21:51:43 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.52: +4 -4
lines
Diff to previous 1.52 (colored) to selected 1.5 (colored)
indent: clean up comments and function names Having accurate names for the lexer symbols and the parser symbols makes most of the comments redundant. Remove these. Rename process_decl to process_type, to match the name of the corresponding lexer symbol. In this phase, it's just a single type token, not a whole declaration. No functional change.
Revision 1.52 / (download) - annotate - [select for diffs], Tue Oct 26 20:43:35 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.51: +3 -2
lines
Diff to previous 1.51 (colored) to selected 1.5 (colored)
indent: make ps.keyword easier to understand Previously, ps.keyword did not have any documentation and was not straight-forward. In some cases it was reset to kw_0, in others it was set to an interesting value. The idea behind it was to remember the kind of word of the previous token, to decide whether to have a space between sizeof or offsetof and a following '('. No functional change.
Revision 1.51 / (download) - annotate - [select for diffs], Tue Oct 26 19:36:30 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.50: +3 -3
lines
Diff to previous 1.50 (colored) to selected 1.5 (colored)
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.
Revision 1.50 / (download) - annotate - [select for diffs], Mon Oct 25 19:56:03 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.49: +4 -4
lines
Diff to previous 1.49 (colored) to selected 1.5 (colored)
indent: rename search_brace to search_stmt No functional change.
Revision 1.49 / (download) - annotate - [select for diffs], Mon Oct 25 00:54:37 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.48: +65 -49
lines
Diff to previous 1.48 (colored) to selected 1.5 (colored)
indent: split type token_type into 3 separate types Previously, token_type was used for 3 different purposes: 1. symbol types from the lexer 2. symbol types on the parser stack 3. kind of control statement for 'if (expr)' and similar statements Splitting the 41 constants into separate types makes it immediately clear that the parser stack never handles comments, preprocessing lines, newlines, form feeds, the inner structure of expressions. Previously, the constant switch_expr was especially confusing since it was used for 3 different purposes: when returned from lexi, it represented the keyword 'switch', in the parser stack it represented 'switch (expr)', and it was used for a statement head as well. The only overlap between the lexer symbols and the parser symbols are '{' and '}', and the keywords 'do' and 'else'. To increase confusion, the constants of the previous token_type were in apparently random order and before 2021, they had cryptic, highly abbreviated names. No functional change.
Revision 1.48 / (download) - annotate - [select for diffs], Sun Oct 24 22:44:13 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.47: +2 -2
lines
Diff to previous 1.47 (colored) to selected 1.5 (colored)
indent: rename form_feed to tt_lex_form_feed No functional change.
Revision 1.47 / (download) - annotate - [select for diffs], Sun Oct 24 22:38:20 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.46: +7 -3
lines
Diff to previous 1.46 (colored) to selected 1.5 (colored)
indent: split kw_for_or_if_or_while into separate constants No functional change.
Revision 1.46 / (download) - annotate - [select for diffs], Sun Oct 24 22:28:06 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.45: +7 -5
lines
Diff to previous 1.45 (colored) to selected 1.5 (colored)
indent: split kw_do_or_else into separate constants It was unnecessarily confusing to have the token types keyword_do_else, keyword_do and keyword_else at the same time, without any hint in what they differed. Some of the token types seem to be used by the lexer while others are used in the parse stack. Maybe all token types can be partitioned into these groups, which would suggest to use two different types for them. And if not, it's still clearer to have this distinction in the names of the constants. No functional change.
Revision 1.45 / (download) - annotate - [select for diffs], Sun Oct 24 11:19:25 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.44: +2 -4
lines
Diff to previous 1.44 (colored) to selected 1.5 (colored)
indent: rename nitems to array_length
Revision 1.44 / (download) - annotate - [select for diffs], Sun Oct 24 11:17:05 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.43: +2 -3
lines
Diff to previous 1.43 (colored) to selected 1.5 (colored)
indent: replace global variable use_ff with function parameter
Revision 1.43 / (download) - annotate - [select for diffs], Wed Oct 20 05:41:57 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.42: +2 -1
lines
Diff to previous 1.42 (colored) to selected 1.5 (colored)
indent: add reminder to make the code understandable for humans
Revision 1.42 / (download) - annotate - [select for diffs], Wed Oct 20 05:37:21 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.41: +2 -2
lines
Diff to previous 1.41 (colored) to selected 1.5 (colored)
indent: rename ps.last_u_d to match its comment No functional change.
Revision 1.41 / (download) - annotate - [select for diffs], Wed Oct 20 05:26:46 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.40: +7 -5
lines
Diff to previous 1.40 (colored) to selected 1.5 (colored)
indent: rename parser stack variables No functional change.
Revision 1.40 / (download) - annotate - [select for diffs], Wed Oct 20 05:14:21 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.39: +3 -3
lines
Diff to previous 1.39 (colored) to selected 1.5 (colored)
indent: rename blankline_requested variables The words 'prefix' and 'postfix' sounded too much like horizontal concepts, like in operators. The actual purpose of these variables is to add blank lines before and after the current line, so use the same wording as in the command line options. No functional change.
Revision 1.39 / (download) - annotate - [select for diffs], Wed Oct 20 05:00:37 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.38: +2 -2
lines
Diff to previous 1.38 (colored) to selected 1.5 (colored)
indent: rename next_blank_lines to blank_lines_to_output The previous name was already an improvement over the name before that (n_real_blanklines), but didn't express the intended purpose clearly enough, so try another name. No functional change.
Revision 1.38 / (download) - annotate - [select for diffs], Sat Oct 9 11:00:27 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.37: +7 -1
lines
Diff to previous 1.37 (colored) to selected 1.5 (colored)
indent: extract common code for advancing a single tab No functional change.
Revision 1.37 / (download) - annotate - [select for diffs], Fri Oct 8 23:43:33 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.36: +4 -4
lines
Diff to previous 1.36 (colored) to selected 1.5 (colored)
indent: rename in_or_st to init_or_struct This makes a few comments redundant. No functional change.
Revision 1.36 / (download) - annotate - [select for diffs], Fri Oct 8 22:17:35 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.35: +1 -4
lines
Diff to previous 1.35 (colored) to selected 1.5 (colored)
indent: convert ps.box_com to local variable This variable is only used in a single function, and that function does not call any other function that could replace the parser state or install a temporary parser state. No functional change.
Revision 1.35 / (download) - annotate - [select for diffs], Fri Oct 8 21:13:58 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.34: +2 -2
lines
Diff to previous 1.34 (colored) to selected 1.5 (colored)
indent: rename fill_buffer to inbuf_read_line No functional change.
Revision 1.34 / (download) - annotate - [select for diffs], Fri Oct 8 19:03:34 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.33: +168 -171
lines
Diff to previous 1.33 (colored) to selected 1.5 (colored)
indent: run indent on indent.h The formatting looks mostly OK. Some struct members had excessively long names, leaving no space for their corresponding comments. Renamed some of them using well-known abbreviations. The formatting for debug_vis_range is messed up, no idea why. It is clearly a function declaration, not a function definition, so there is no need to place the function name in column 1. No functional change.
Revision 1.33 / (download) - annotate - [select for diffs], Fri Oct 8 17:19:49 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.32: +2 -3
lines
Diff to previous 1.32 (colored) to selected 1.5 (colored)
indent: replace column calculations with indent, part 4/4
Revision 1.32 / (download) - annotate - [select for diffs], Fri Oct 8 16:20:33 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.31: +3 -3
lines
Diff to previous 1.31 (colored) to selected 1.5 (colored)
indent: rename tokens lparen and rparen to be more precise No functional change.
Revision 1.31 / (download) - annotate - [select for diffs], Fri Oct 8 16:16:54 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.30: +298 -3
lines
Diff to previous 1.30 (colored) to selected 1.5 (colored)
indent: merge headers into a single file No functional change.
Revision 1.30 / (download) - annotate - [select for diffs], Thu Oct 7 19:42:41 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.29: +2 -2
lines
Diff to previous 1.29 (colored) to selected 1.5 (colored)
indent: remove global variable option_source It is only needed at startup, while parsing the options. The string "?" was not needed at all. No functional change.
Revision 1.29 / (download) - annotate - [select for diffs], Tue Oct 5 06:09:42 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.28: +7 -1
lines
Diff to previous 1.28 (colored) to selected 1.5 (colored)
indent: merge duplicate code into is_hspace No functional change.
Revision 1.28 / (download) - annotate - [select for diffs], Tue Oct 5 05:39:14 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.27: +3 -1
lines
Diff to previous 1.27 (colored) to selected 1.5 (colored)
indent: merge duplicate code for reading from input buffer No functional change.
Revision 1.27 / (download) - annotate - [select for diffs], Sun Oct 3 18:44:51 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.26: +2 -2
lines
Diff to previous 1.26 (colored) to selected 1.5 (colored)
indent: rename functions There was no good reason for using the different verbs 'scan' and 'set' for two functions that essentially do the same. No functional change.
Revision 1.26 / (download) - annotate - [select for diffs], Mon Sep 27 18:21:47 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.25: +1 -2
lines
Diff to previous 1.25 (colored) to selected 1.5 (colored)
indent: use binary instead of linear search when adding types No functional change.
Revision 1.25 / (download) - annotate - [select for diffs], Sat Sep 25 22:14:21 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.24: +3 -1
lines
Diff to previous 1.24 (colored) to selected 1.5 (colored)
indent: merge duplicate code for token buffers No functional change.
Revision 1.24 / (download) - annotate - [select for diffs], Sat Sep 25 21:42:43 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.23: +2 -2
lines
Diff to previous 1.23 (colored) to selected 1.5 (colored)
indent: clean up argument handling No functional change.
Revision 1.23 / (download) - annotate - [select for diffs], Sat Sep 25 19:49:13 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.22: +1 -2
lines
Diff to previous 1.22 (colored) to selected 1.5 (colored)
indent: reduce code and data size for lexing of numbers Instead of having a table of strings (121 pointers + 121 data relocations), reduce that table to the actual character data and use a secondary table for looking up the correct row in the main table. No functional change.
Revision 1.22 / (download) - annotate - [select for diffs], Sat Sep 25 17:36:51 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.21: +1 -7
lines
Diff to previous 1.21 (colored) to selected 1.5 (colored)
indent: convert remaining ibool to bool No functional change intended.
Revision 1.21 / (download) - annotate - [select for diffs], Sat Sep 25 17:11:23 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.20: +7 -1
lines
Diff to previous 1.20 (colored) to selected 1.5 (colored)
indent: prepare for lint's strict bool mode Before C99, C had no boolean type. Instead, indent used int for that, just like many other programs. Even with C99, bool and int can be used interchangeably in many situations, such as querying '!i' or '!ptr' or 'cond == 0'. Since January 2021, lint provides the strict bool mode, which makes bool a non-arithmetic type that is incompatible with any other type. Having clearly separate types helps in understanding the code. To migrate indent to strict bool mode, the first step is to apply all changes that keep the resulting binary the same. Since sizeof(bool) is 1 and sizeof(int) is 4, the type ibool serves as an intermediate type. For now it is defined to int, later it will become bool. The current code compiles cleanly in C99 and C11 mode, as well as in lint's strict bool mode. There are a few tricky places: In args.c in 'struct pro', there are two types of options: boolean and integer. Boolean options point to a bool variable, integer options point to an int variable. To keep the current structure of the code, the pointer has been changed to 'void *'. To ensure type safety, the definition of the options is done via preprocessor magic, which in C11 mode ensures the correct pointer types. (Add CFLAGS+=-std=gnu11 at the very bottom of the Makefile.) In indent.c in process_preprocessing, a boolean variable is post-incremented. That variable is only assigned to another variable, and that variable is only used in a boolean context. To provoke a different behavior between the '++' and the '= true', the source code to be indented would need 1 << 32 preprocessing directives, which is unlikely to happen in practice. In io.c in dump_line, the variables ps.in_stmt and ps.in_decl only ever get the values 0 and 1. For these values, the expressions 'a & ~b' and 'a && !b' are equivalent, in all versions of C. The compiler may generate different code for them, though. In io.c in parse_indent_comment, the assignment to inhibit_formatting takes place in integer context. If the compiler is smart enough to detect the possible values of on_off, it may generate the same code before and after the change, but that is rather unlikely. The second step of the migration will be to replace ibool with bool, step by step, just in case there are any hidden gotchas in the code, such as sizeof or pointer casts. No change to the resulting binary.
Revision 1.20 / (download) - annotate - [select for diffs], Sat Sep 25 14:38:31 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.19: +3 -1
lines
Diff to previous 1.19 (colored) to selected 1.5 (colored)
indent: use standard definition for bool, true, false
Revision 1.19 / (download) - annotate - [select for diffs], Sat Sep 25 14:16:06 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.18: +1 -2
lines
Diff to previous 1.18 (colored) to selected 1.5 (colored)
indent: clean up initialization of options The default values in 'struct pro' were redundant but all consistent, even with the commented defaults in main_parse_command_line. No functional change.
Revision 1.18 / (download) - annotate - [select for diffs], Sat Sep 25 13:38:32 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.17: +1 -3
lines
Diff to previous 1.17 (colored) to selected 1.5 (colored)
indent: remove ifdef for lint NetBSD lint does not need them anymore, FreeBSD does not have lint.
Revision 1.17 / (download) - annotate - [select for diffs], Sat Sep 25 08:23:31 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.16: +5 -1
lines
Diff to previous 1.16 (colored) to selected 1.5 (colored)
indent: add nonnull memory allocation functions The only functional change is a single error message.
Revision 1.16 / (download) - annotate - [select for diffs], Sun Mar 14 00:33:25 2021 UTC (3 years ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1,
cjep_sun2x-base,
cjep_sun2x,
cjep_staticlib_x-base1,
cjep_staticlib_x-base,
cjep_staticlib_x
Changes since 1.15: +25 -24
lines
Diff to previous 1.15 (colored) to selected 1.5 (colored)
indent: give indent a try at formatting its own code Formatting indent.h required the following manual corrections afterwards: The first tab in the comment in line 1 was replaced with a space but shouldn't be. The spacing around the '...' in function prototypes was completely wrong. It looked like 'const char *,...)__printflike', without any spaces. The '*' of the return type 'const char *' was tied to the function name, even though this declaration was only for a single function. In such a case, it's more appropriate to line up the function names. The function-like macros were not indented to -di. This is something that I would not expect from indent, so it's ok to do that manually.
Revision 1.15 / (download) - annotate - [select for diffs], Sat Mar 13 23:42:23 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.14: +2 -4
lines
Diff to previous 1.14 (colored) to selected 1.5 (colored)
indent: remove disabled duplicate RCS ID from header By convention, headers don't record their RCS ID.
Revision 1.14 / (download) - annotate - [select for diffs], Sat Mar 13 13:25:23 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.13: +3 -3
lines
Diff to previous 1.13 (colored) to selected 1.5 (colored)
indent: rename pr_comment to process_comment, clean up documentation No functional change.
Revision 1.13 / (download) - annotate - [select for diffs], Sat Mar 13 10:32:25 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.12: +2 -4
lines
Diff to previous 1.12 (colored) to selected 1.5 (colored)
indent: inline calls to count_spaces and count_spaces_until These two functions operated on column numbers instead of indentation, which required adjustments of '+ 1' and '- 1'. Their names were completely wrong since these functions did not count anything, instead they computed the column. No functional change.
Revision 1.12 / (download) - annotate - [select for diffs], Sat Mar 13 10:20:54 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.11: +4 -2
lines
Diff to previous 1.11 (colored) to selected 1.5 (colored)
indent: replace column computation with indentation computation No functional change.
Revision 1.11 / (download) - annotate - [select for diffs], Sat Mar 13 10:06:47 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.10: +3 -3
lines
Diff to previous 1.10 (colored) to selected 1.5 (colored)
indent: replace compute_code_column with compute_code_indent The goal is to only ever be concerned about the _indentation_ of a token, never the _column_ it appears in. Having only one of these avoids off-by-one errors. No functional change.
Revision 1.10 / (download) - annotate - [select for diffs], Sat Mar 13 09:54:11 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.9: +3 -3
lines
Diff to previous 1.9 (colored) to selected 1.5 (colored)
indent: replace compute_label_column with compute_label_indent Using the invariant 'column == 1 + indent'. This removes several overly complicated '+ 1' from the code that are not needed conceptually. No functional change.
Revision 1.9 / (download) - annotate - [select for diffs], Sat Mar 13 09:21:57 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.8: +9 -2
lines
Diff to previous 1.8 (colored) to selected 1.5 (colored)
indent: add debug logging for actually writing to the output file Together with the results of the tokenizer and the 4 buffers for token, label, code and comment, the debug log now provides a good high-level view on how the indentation happens and where to look for the many remaining bugs.
Revision 1.8 / (download) - annotate - [select for diffs], Sat Mar 13 00:26:56 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.7: +4 -4
lines
Diff to previous 1.7 (colored) to selected 1.5 (colored)
indent: replace pad_output with output_indent Calculating the indentation is simpler than calculating the column, since that saves the constant addition and subtraction of the 1. No functional change.
Revision 1.7 / (download) - annotate - [select for diffs], Fri Mar 12 23:27:41 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.6: +4 -4
lines
Diff to previous 1.6 (colored) to selected 1.5 (colored)
indent: add 'const', rename variables, reorder formula for tab width Column counting starts at 1. This 1 should rather be at the beginning of the formula since it is thought of being added at the very beginning of the line, not at the end. When adding a tab, the newly added tab is added at the end of the string, therefore that '+ 1' should be at the end of the formula as well. No functional change.
Revision 1.6 / (download) - annotate - [select for diffs], Fri Mar 12 23:16:00 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.5: +4 -4
lines
Diff to previous 1.5 (colored)
indent: replace 'target' with 'indent' in function names The word 'target' was not as specific as possible. No functional change.
Revision 1.5 / (download) - annotate - [selected], Sun Mar 7 11:32:05 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.4: +5 -2
lines
Diff to previous 1.4 (colored)
indent: in debug mode, output detailed token information The main ingredient for understanding how indent works is the tokenizer and the 4 buffers in which the text is collected. Inspecting this debug log for the test comment-line-end makes it obvious why indent messes up code that contains '//' comments. The cause is that indent interprets '//' as an operator, just like '&&' or '||'. The sequence '/////' is interpreted as a single operator as well, by the way. Since '//' is interpreted as an ordinary operator, any words following it are plain identifiers, usually several of them in a row, which is a syntax error. Depending on the context, the operator '//' is either a unary operator (no space around) or a binary operator (space around). This explains why the word 'line-end' is expanded to 'line - end'. No functional change outside of debug mode.
Revision 1.4 / (download) - annotate - [select for diffs], Sun Mar 7 10:56:18 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.3: +4 -4
lines
Diff to previous 1.3 (colored) to selected 1.5 (colored)
indent: for the token types, use enum instead of #define This makes it easier to step through the code in a debugger. No functional change.
Revision 1.3 / (download) - annotate - [select for diffs], Sun Mar 7 10:42:48 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.2: +5 -2
lines
Diff to previous 1.2 (colored) to selected 1.5 (colored)
indent: use all headers in all files This is a prerequisite for converting the token types to an enum instead of a preprocessor define, since the return type of lexi will become token_type. Having the enum will make debugging easier. There was a single naming collision, which forced the variable in scan_profile to be renamed. All other token names are used nowhere else. No change to the resulting binary.
Revision 1.1.2.3 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:43 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.1.2.2: +3 -5
lines
Diff to previous 1.1.2.2 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored) to selected 1.5 (colored)
Mostly merge changes from HEAD upto 20200411
Revision 1.2 / (download) - annotate - [select for diffs], Sat Oct 19 15:44:31 2019 UTC (4 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20200421,
phil-wifi-20200411,
phil-wifi-20200406,
phil-wifi-20191119,
is-mlppp-base,
is-mlppp
Changes since 1.1: +3 -5
lines
Diff to previous 1.1 (colored) to selected 1.5 (colored)
use stdarg, annotate function as __printflike and fix broken formats.
Revision 1.1.2.2 / (download) - annotate - [select for diffs], Mon Jun 10 22:10:20 2019 UTC (4 years, 9 months ago) by christos
Branch: phil-wifi
Changes since 1.1.2.1: +60 -0
lines
Diff to previous 1.1.2.1 (colored) to branchpoint 1.1 (colored) to selected 1.5 (colored)
Sync with HEAD
Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Thu Apr 4 20:39:17 2019 UTC (4 years, 11 months ago) by kamil
Branch: FREEBSD
CVS Tags: r340138
Changes since 1.1: +0 -10
lines
Diff to previous 1.1 (colored) to selected 1.5 (colored)
FreeBSD indent r340138
Revision 1.1.2.1, Thu Apr 4 15:27:35 2019 UTC (4 years, 11 months ago) by christos
Branch: phil-wifi
Changes since 1.1: +0 -60
lines
FILE REMOVED
file indent.h was added on branch phil-wifi on 2019-06-10 22:10:20 +0000
Revision 1.1 / (download) - annotate - [select for diffs], Thu Apr 4 15:27:35 2019 UTC (4 years, 11 months ago) by kamil
Branch: MAIN
CVS Tags: phil-wifi-20190609,
netbsd-9-base,
netbsd-9-3-RELEASE,
netbsd-9-2-RELEASE,
netbsd-9-1-RELEASE,
netbsd-9-0-RELEASE,
netbsd-9-0-RC2,
netbsd-9-0-RC1,
netbsd-9
Branch point for: phil-wifi
Diff to selected 1.5 (colored)
Upgrade indent(1) Merge all the changes from the recent FreeBSD HEAD snapshot into our local copy. FreeBSD actively maintains this program in their sources and their repository contains over 100 commits with changes. Keep the delta between the FreeBSD and NetBSD versions to absolute minimum, mostly RCS Id and compatiblity fixes. Major chages in this import: - Added an option -ldi<N> to control indentation of local variable names. - Added option -P for loading user-provided files as profiles - Added -tsn for setting tabsize - Rename -nsac/-sac ("space after cast") to -ncs/-cs - Added option -fbs Enables (disables) splitting the function declaration and opening brace across two lines. - Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1) - Group global option variables into an options structure - Use bsearch() for looking up type keywords. - Don't produce unneeded space character in function declarators - Don't unnecessarily add a blank before a comment ends. - Don't ignore newlines after comments that follow braces. Merge the FreeBSD intend(1) tests with our ATF framework. All tests pass. Upgrade prepared by Manikishan Ghantasala. Final polishing by myself. Part II, checkin new files.