indent.h revision 1.93 1 1.93 rillig /* $NetBSD: indent.h,v 1.93 2021/11/19 17:59:16 rillig Exp $ */
2 1.1 kamil
3 1.1 kamil /*-
4 1.1 kamil * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 1.1 kamil *
6 1.1 kamil * Copyright (c) 2001 Jens Schweikhardt
7 1.1 kamil * All rights reserved.
8 1.1 kamil *
9 1.1 kamil * Redistribution and use in source and binary forms, with or without
10 1.1 kamil * modification, are permitted provided that the following conditions
11 1.1 kamil * are met:
12 1.1 kamil * 1. Redistributions of source code must retain the above copyright
13 1.1 kamil * notice, this list of conditions and the following disclaimer.
14 1.1 kamil * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 kamil * notice, this list of conditions and the following disclaimer in the
16 1.1 kamil * documentation and/or other materials provided with the distribution.
17 1.1 kamil *
18 1.1 kamil * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
19 1.1 kamil * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 1.1 kamil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 1.1 kamil * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
22 1.1 kamil * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.1 kamil * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 1.1 kamil * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1 kamil * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.1 kamil * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1 kamil * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1 kamil * SUCH DAMAGE.
29 1.1 kamil */
30 1.31 rillig /*-
31 1.31 rillig * SPDX-License-Identifier: BSD-4-Clause
32 1.31 rillig *
33 1.31 rillig * Copyright (c) 1985 Sun Microsystems, Inc.
34 1.31 rillig * Copyright (c) 1980, 1993
35 1.31 rillig * The Regents of the University of California. All rights reserved.
36 1.31 rillig * All rights reserved.
37 1.31 rillig *
38 1.31 rillig * Redistribution and use in source and binary forms, with or without
39 1.31 rillig * modification, are permitted provided that the following conditions
40 1.31 rillig * are met:
41 1.31 rillig * 1. Redistributions of source code must retain the above copyright
42 1.31 rillig * notice, this list of conditions and the following disclaimer.
43 1.31 rillig * 2. Redistributions in binary form must reproduce the above copyright
44 1.31 rillig * notice, this list of conditions and the following disclaimer in the
45 1.31 rillig * documentation and/or other materials provided with the distribution.
46 1.31 rillig * 3. All advertising materials mentioning features or use of this software
47 1.31 rillig * must display the following acknowledgement:
48 1.31 rillig * This product includes software developed by the University of
49 1.31 rillig * California, Berkeley and its contributors.
50 1.31 rillig * 4. Neither the name of the University nor the names of its contributors
51 1.31 rillig * may be used to endorse or promote products derived from this software
52 1.31 rillig * without specific prior written permission.
53 1.31 rillig *
54 1.31 rillig * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 1.31 rillig * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 1.31 rillig * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 1.31 rillig * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 1.31 rillig * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 1.31 rillig * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 1.31 rillig * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 1.31 rillig * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 1.31 rillig * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 1.31 rillig * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 1.31 rillig * SUCH DAMAGE.
65 1.31 rillig */
66 1.1 kamil
67 1.1 kamil #if 0
68 1.1 kamil __FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $");
69 1.1 kamil #endif
70 1.1 kamil
71 1.20 rillig #include <stdbool.h>
72 1.65 rillig #include <stdio.h>
73 1.20 rillig
74 1.49 rillig typedef enum lexer_symbol {
75 1.49 rillig lsym_eof,
76 1.49 rillig lsym_preprocessing, /* '#' */
77 1.49 rillig lsym_newline,
78 1.49 rillig lsym_form_feed,
79 1.74 rillig lsym_comment, /* the initial '/ *' or '//' of a comment */
80 1.49 rillig lsym_lparen_or_lbracket,
81 1.49 rillig lsym_rparen_or_rbracket,
82 1.49 rillig lsym_lbrace,
83 1.49 rillig lsym_rbrace,
84 1.49 rillig lsym_period,
85 1.74 rillig lsym_unary_op, /* e.g. '*', '&', '-' or leading '++' */
86 1.74 rillig lsym_binary_op, /* e.g. '*', '&', '<<', '&&' or '/=' */
87 1.49 rillig lsym_postfix_op, /* trailing '++' or '--' */
88 1.49 rillig lsym_question, /* the '?' from a '?:' expression */
89 1.49 rillig lsym_colon,
90 1.49 rillig lsym_comma,
91 1.49 rillig lsym_semicolon,
92 1.49 rillig lsym_typedef,
93 1.49 rillig lsym_storage_class,
94 1.81 rillig lsym_type_outside_parentheses,
95 1.80 rillig lsym_type_in_parentheses,
96 1.53 rillig lsym_tag, /* 'struct', 'union' or 'enum' */
97 1.53 rillig lsym_case_label, /* 'case' or 'default' */
98 1.49 rillig lsym_string_prefix, /* 'L' */
99 1.69 rillig lsym_sizeof,
100 1.70 rillig lsym_offsetof,
101 1.80 rillig lsym_word, /* identifier, constant or string */
102 1.49 rillig lsym_funcname,
103 1.49 rillig lsym_do,
104 1.49 rillig lsym_else,
105 1.49 rillig lsym_for,
106 1.49 rillig lsym_if,
107 1.49 rillig lsym_switch,
108 1.49 rillig lsym_while,
109 1.75 rillig lsym_return
110 1.49 rillig } lexer_symbol;
111 1.49 rillig
112 1.49 rillig typedef enum parser_symbol {
113 1.49 rillig psym_semicolon, /* rather a placeholder than a semicolon */
114 1.49 rillig psym_lbrace,
115 1.49 rillig psym_rbrace,
116 1.49 rillig psym_decl,
117 1.49 rillig psym_stmt,
118 1.49 rillig psym_stmt_list,
119 1.49 rillig psym_for_exprs, /* 'for' '(' ... ')' */
120 1.49 rillig psym_if_expr, /* 'if' '(' expr ')' */
121 1.49 rillig psym_if_expr_stmt, /* 'if' '(' expr ')' stmt */
122 1.49 rillig psym_if_expr_stmt_else, /* 'if' '(' expr ')' stmt 'else' */
123 1.49 rillig psym_else, /* 'else' */
124 1.49 rillig psym_switch_expr, /* 'switch' '(' expr ')' */
125 1.49 rillig psym_do, /* 'do' */
126 1.49 rillig psym_do_stmt, /* 'do' stmt */
127 1.49 rillig psym_while_expr, /* 'while' '(' expr ')' */
128 1.49 rillig } parser_symbol;
129 1.49 rillig
130 1.49 rillig typedef enum stmt_head {
131 1.49 rillig hd_0, /* placeholder for uninitialized */
132 1.49 rillig hd_for,
133 1.49 rillig hd_if,
134 1.49 rillig hd_switch,
135 1.49 rillig hd_while,
136 1.49 rillig } stmt_head;
137 1.31 rillig
138 1.61 rillig /* A range of characters, in some cases null-terminated. */
139 1.31 rillig struct buffer {
140 1.61 rillig char *s; /* start of the usable text */
141 1.61 rillig char *e; /* end of the usable text */
142 1.61 rillig char *buf; /* start of the allocated memory */
143 1.61 rillig char *l; /* end of the allocated memory */
144 1.31 rillig };
145 1.31 rillig
146 1.87 rillig extern struct input_buffer {
147 1.87 rillig struct buffer inp; /* one line of input, ready to be split into
148 1.87 rillig * tokens; occasionally this buffer switches
149 1.88 rillig * to save_com_buf */
150 1.88 rillig char save_com_buf[5000]; /* input text is saved here when looking for
151 1.87 rillig * the brace after an if, while, etc */
152 1.88 rillig char *save_com_s; /* start of the comment in save_com_buf */
153 1.88 rillig char *save_com_e; /* end of the comment in save_com_buf */
154 1.87 rillig
155 1.87 rillig char *saved_inp_s; /* saved value of inp.s when taking input from
156 1.87 rillig * save_com */
157 1.87 rillig char *saved_inp_e; /* similarly saved value of inp.e */
158 1.87 rillig } inbuf;
159 1.87 rillig
160 1.34 rillig extern FILE *input;
161 1.34 rillig extern FILE *output;
162 1.31 rillig
163 1.61 rillig extern struct buffer token; /* the current token to be processed, is
164 1.61 rillig * typically copied to the buffer 'code',
165 1.61 rillig * or in some cases to 'lab'. */
166 1.61 rillig
167 1.61 rillig extern struct buffer lab; /* the label or preprocessor directive */
168 1.61 rillig extern struct buffer code; /* the main part of the current line of code */
169 1.61 rillig extern struct buffer com; /* the trailing comment of the line, or the
170 1.83 rillig * start or end of a multi-line comment, or
171 1.83 rillig * while in process_comment, a single line of
172 1.83 rillig * a multi-line comment */
173 1.31 rillig
174 1.31 rillig extern struct options {
175 1.34 rillig bool blanklines_around_conditional_compilation;
176 1.34 rillig bool blanklines_after_decl_at_top; /* this is vaguely similar to
177 1.34 rillig * blanklines_after_decl except that
178 1.34 rillig * it only applies to the first set of
179 1.34 rillig * declarations in a procedure (just
180 1.34 rillig * after the first '{') and it causes
181 1.34 rillig * a blank line to be generated even
182 1.34 rillig * if there are no declarations */
183 1.34 rillig bool blanklines_after_decl;
184 1.34 rillig bool blanklines_after_procs;
185 1.34 rillig bool blanklines_before_block_comments;
186 1.34 rillig bool break_after_comma; /* whether to break declarations after commas */
187 1.34 rillig bool brace_same_line; /* whether brace should be on same line as if,
188 1.34 rillig * while, etc */
189 1.34 rillig bool blank_after_sizeof; /* whether a blank should always be inserted
190 1.34 rillig * after sizeof */
191 1.34 rillig bool comment_delimiter_on_blankline;
192 1.34 rillig int decl_comment_column; /* the column in which comments after
193 1.31 rillig * declarations should be put */
194 1.34 rillig bool cuddle_else; /* whether 'else' should cuddle up to '}' */
195 1.34 rillig int continuation_indent; /* the indentation between the edge of code
196 1.34 rillig * and continuation lines */
197 1.34 rillig float case_indent; /* The distance (measured in indentation
198 1.31 rillig * levels) to indent case labels from the
199 1.31 rillig * switch statement */
200 1.34 rillig int comment_column; /* the column in which comments to the right
201 1.31 rillig * of code should start */
202 1.34 rillig int decl_indent; /* indentation of identifier in declaration */
203 1.34 rillig bool ljust_decl; /* true if declarations should be left
204 1.31 rillig * justified */
205 1.34 rillig int unindent_displace; /* comments not to the right of code will be
206 1.34 rillig * placed this many indentation levels to the
207 1.34 rillig * left of code */
208 1.34 rillig bool extra_expr_indent; /* whether continuation lines from the
209 1.34 rillig * expression part of "if(e)", "while(e)",
210 1.34 rillig * "for(e;e;e)" should be indented an extra
211 1.34 rillig * tab stop so that they don't conflict with
212 1.34 rillig * the code that follows */
213 1.34 rillig bool else_if; /* whether else-if pairs should be handled
214 1.31 rillig * specially */
215 1.34 rillig bool function_brace_split; /* split function declaration and brace onto
216 1.34 rillig * separate lines */
217 1.34 rillig bool format_col1_comments; /* If comments which start in column 1 are to
218 1.34 rillig * be magically reformatted (just like
219 1.34 rillig * comments that begin in later columns) */
220 1.34 rillig bool format_block_comments; /* whether comments beginning with '/ * \n'
221 1.34 rillig * are to be reformatted */
222 1.34 rillig bool indent_parameters;
223 1.34 rillig int indent_size; /* the size of one indentation level */
224 1.34 rillig int block_comment_max_line_length;
225 1.34 rillig int local_decl_indent; /* like decl_indent but for locals */
226 1.34 rillig bool lineup_to_parens_always; /* whether to not(?) attempt to keep
227 1.34 rillig * lined-up code within the margin */
228 1.34 rillig bool lineup_to_parens; /* whether continued code within parens will
229 1.34 rillig * be lined up to the open paren */
230 1.34 rillig bool proc_calls_space; /* whether function calls look like: foo (bar)
231 1.34 rillig * rather than foo(bar) */
232 1.34 rillig bool procnames_start_line; /* whether the names of procedures being
233 1.34 rillig * defined get placed in column 1 (i.e. a
234 1.34 rillig * newline is placed between the type of the
235 1.34 rillig * procedure and its name) */
236 1.34 rillig bool space_after_cast; /* "b = (int) a" vs "b = (int)a" */
237 1.34 rillig bool star_comment_cont; /* whether comment continuation lines should
238 1.34 rillig * have stars at the beginning of each line. */
239 1.34 rillig bool swallow_optional_blanklines;
240 1.34 rillig bool auto_typedefs; /* whether to recognize identifiers ending in
241 1.34 rillig * "_t" like typedefs */
242 1.34 rillig int tabsize; /* the size of a tab */
243 1.34 rillig int max_line_length;
244 1.34 rillig bool use_tabs; /* set true to use tabs for spacing, false
245 1.31 rillig * uses all spaces */
246 1.34 rillig bool verbose; /* whether non-essential error messages are
247 1.34 rillig * printed */
248 1.51 rillig } opt;
249 1.31 rillig
250 1.34 rillig extern bool found_err;
251 1.39 rillig extern int blank_lines_to_output;
252 1.40 rillig extern bool blank_line_before;
253 1.40 rillig extern bool blank_line_after;
254 1.56 rillig extern bool break_comma; /* when true and not in parentheses, break
255 1.56 rillig * after a comma */
256 1.34 rillig extern float case_ind; /* indentation level to be used for a "case
257 1.31 rillig * n:" */
258 1.34 rillig extern bool had_eof; /* whether input is exhausted */
259 1.34 rillig extern int line_no; /* the current line number. */
260 1.34 rillig extern bool inhibit_formatting; /* true if INDENT OFF is in effect */
261 1.31 rillig
262 1.31 rillig #define STACKSIZE 256
263 1.31 rillig
264 1.31 rillig extern struct parser_state {
265 1.84 rillig lexer_symbol prev_token; /* the previous token, but never comment,
266 1.84 rillig * newline or preprocessing line */
267 1.66 rillig bool curr_col_1; /* whether the current token started in column
268 1.66 rillig * 1 of the unformatted input */
269 1.77 rillig bool next_col_1;
270 1.59 rillig bool next_unary; /* whether the following operator should be
271 1.59 rillig * unary */
272 1.59 rillig
273 1.86 rillig char procname[100]; /* The name of the current procedure; TODO:
274 1.86 rillig * document the difference between procname[0]
275 1.86 rillig * being '\0', ' ' and a real character */
276 1.59 rillig
277 1.41 rillig
278 1.59 rillig bool want_blank; /* whether the following token should be
279 1.59 rillig * prefixed by a blank. (Said prefixing is
280 1.59 rillig * ignored in some cases.) */
281 1.59 rillig
282 1.59 rillig int paren_level; /* parenthesization level. used to indent
283 1.86 rillig * within statements, initializers and
284 1.86 rillig * declarations */
285 1.59 rillig /* TODO: rename to next_line_paren_level */
286 1.59 rillig int p_l_follow; /* how to indent the remaining lines of the
287 1.86 rillig * statement or initializer or declaration */
288 1.59 rillig short paren_indents[20]; /* indentation of the operand/argument of each
289 1.59 rillig * level of parentheses or brackets, relative
290 1.78 rillig * to the enclosing statement; if negative,
291 1.78 rillig * reflected at -1 */
292 1.59 rillig int cast_mask; /* indicates which close parentheses
293 1.59 rillig * potentially close off casts */
294 1.59 rillig int not_cast_mask; /* indicates which close parentheses
295 1.59 rillig * definitely close off something else than
296 1.59 rillig * casts */
297 1.41 rillig
298 1.34 rillig int comment_delta; /* used to set up indentation for all lines of
299 1.34 rillig * a boxed comment after the first one */
300 1.34 rillig int n_comment_delta; /* remembers how many columns there were
301 1.31 rillig * before the start of a box comment so that
302 1.31 rillig * forthcoming lines of the comment are
303 1.31 rillig * indented properly */
304 1.59 rillig int com_ind; /* indentation of the current comment */
305 1.59 rillig
306 1.34 rillig bool block_init; /* whether inside a block initialization */
307 1.34 rillig int block_init_level; /* The level of brace nesting in an
308 1.31 rillig * initialization */
309 1.37 rillig bool init_or_struct; /* whether there has been a declarator (e.g.
310 1.37 rillig * int or char) and no left parenthesis since
311 1.37 rillig * the last semicolon. When true, a '{' is
312 1.34 rillig * starting a structure definition or an
313 1.34 rillig * initialization list */
314 1.59 rillig
315 1.82 rillig int ind_level; /* the indentation level for the line that is
316 1.82 rillig * currently prepared for output */
317 1.59 rillig int ind_level_follow; /* the level to which ind_level should be set
318 1.59 rillig * after the current line is printed */
319 1.59 rillig
320 1.85 rillig int decl_level; /* current nesting level for a structure
321 1.85 rillig * declaration or an initializer */
322 1.34 rillig bool decl_on_line; /* whether this line of code has part of a
323 1.34 rillig * declaration on it */
324 1.34 rillig bool in_decl; /* whether we are in a declaration stmt. The
325 1.34 rillig * processing of braces is then slightly
326 1.31 rillig * different */
327 1.59 rillig int just_saw_decl;
328 1.59 rillig bool in_parameter_declaration;
329 1.59 rillig bool decl_indent_done; /* whether the indentation for a declaration
330 1.59 rillig * has been added to the code buffer. */
331 1.59 rillig
332 1.86 rillig bool in_stmt; /* TODO: rename to something appropriate; this
333 1.86 rillig * is set to true in struct declarations as
334 1.86 rillig * well, so 'stmt' isn't accurate */
335 1.34 rillig bool ind_stmt; /* whether the next line should have an extra
336 1.31 rillig * indentation level because we are in the
337 1.59 rillig * middle of a statement */
338 1.34 rillig bool is_case_label; /* 'case' and 'default' labels are indented
339 1.31 rillig * differently from regular labels */
340 1.59 rillig
341 1.50 rillig bool search_stmt; /* whether it is necessary to buffer up all
342 1.50 rillig * text up to the start of a statement after
343 1.86 rillig * an 'if (expr)', 'while (expr)', etc., to
344 1.86 rillig * move the comments after the opening brace
345 1.86 rillig * of the following statement */
346 1.59 rillig
347 1.59 rillig int tos; /* pointer to top of stack */
348 1.59 rillig parser_symbol s_sym[STACKSIZE];
349 1.59 rillig int s_ind_level[STACKSIZE];
350 1.59 rillig float s_case_ind_level[STACKSIZE];
351 1.31 rillig
352 1.31 rillig struct {
353 1.34 rillig int comments;
354 1.34 rillig int lines;
355 1.34 rillig int code_lines;
356 1.34 rillig int comment_lines;
357 1.34 rillig } stats;
358 1.51 rillig } ps;
359 1.31 rillig
360 1.3 rillig
361 1.59 rillig #define array_length(array) (sizeof(array) / sizeof((array)[0]))
362 1.1 kamil
363 1.5 rillig #ifdef debug
364 1.34 rillig void
365 1.34 rillig debug_vis_range(const char *, const char *, const char *,
366 1.34 rillig const char *);
367 1.34 rillig void debug_printf(const char *, ...)__printflike(1, 2);
368 1.34 rillig void debug_println(const char *, ...)__printflike(1, 2);
369 1.9 rillig #else
370 1.16 rillig #define debug_printf(fmt, ...) do { } while (false)
371 1.16 rillig #define debug_println(fmt, ...) do { } while (false)
372 1.16 rillig #define debug_vis_range(prefix, s, e, suffix) do { } while (false)
373 1.5 rillig #endif
374 1.67 rillig
375 1.74 rillig void register_typename(const char *);
376 1.67 rillig int compute_code_indent(void);
377 1.67 rillig int compute_label_indent(void);
378 1.76 rillig int ind_add(int, const char *, const char *);
379 1.67 rillig
380 1.91 rillig const char *inp_p(void);
381 1.91 rillig const char *inp_line_end(void);
382 1.89 rillig char inp_peek(void);
383 1.90 rillig char inp_lookahead(size_t);
384 1.79 rillig void inp_skip(void);
385 1.79 rillig char inp_next(void);
386 1.89 rillig
387 1.93 rillig void inp_comment_init_newline(void);
388 1.93 rillig void inp_comment_init_comment(void);
389 1.92 rillig void inp_comment_add_char(char);
390 1.92 rillig void inp_comment_add_range(const char *, const char *);
391 1.93 rillig bool inp_comment_complete_block(void);
392 1.92 rillig
393 1.92 rillig void inp_from_comment(void);
394 1.92 rillig
395 1.92 rillig #ifdef debug
396 1.92 rillig void debug_inp(const char *);
397 1.92 rillig #else
398 1.92 rillig #define debug_inp(prefix) do { } while (false)
399 1.92 rillig #endif
400 1.92 rillig
401 1.54 rillig lexer_symbol lexi(void);
402 1.34 rillig void diag(int, const char *, ...)__printflike(2, 3);
403 1.34 rillig void dump_line(void);
404 1.44 rillig void dump_line_ff(void);
405 1.79 rillig void inp_read_line(void);
406 1.49 rillig void parse(parser_symbol);
407 1.55 rillig void parse_stmt_head(stmt_head);
408 1.34 rillig void process_comment(void);
409 1.34 rillig void set_option(const char *, const char *);
410 1.34 rillig void load_profiles(const char *);
411 1.34 rillig
412 1.34 rillig void *xmalloc(size_t);
413 1.34 rillig void *xrealloc(void *, size_t);
414 1.34 rillig char *xstrdup(const char *);
415 1.25 rillig
416 1.34 rillig void buf_expand(struct buffer *, size_t);
417 1.29 rillig
418 1.29 rillig static inline bool
419 1.62 rillig ch_isblank(char ch)
420 1.29 rillig {
421 1.29 rillig return ch == ' ' || ch == '\t';
422 1.29 rillig }
423 1.38 rillig
424 1.38 rillig static inline int
425 1.38 rillig next_tab(int ind)
426 1.38 rillig {
427 1.38 rillig return ind - ind % opt.tabsize + opt.tabsize;
428 1.38 rillig }
429