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.
This commit is contained in:
rillig 2023-06-16 11:27:49 +00:00
parent 66c213d6e4
commit 37a177106a
4 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: debug.c,v 1.62 2023/06/15 10:59:06 rillig Exp $ */
/* $NetBSD: debug.c,v 1.63 2023/06/16 11:27:49 rillig Exp $ */
/*-
* Copyright (c) 2023 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: debug.c,v 1.62 2023/06/15 10:59:06 rillig Exp $");
__RCSID("$NetBSD: debug.c,v 1.63 2023/06/16 11:27:49 rillig Exp $");
#include <stdarg.h>
#include <string.h>
@ -363,7 +363,7 @@ debug_parser_state(void)
state.heading = "indentation of comments";
debug_ps_int(comment_ind);
debug_ps_int(comment_shift);
debug_ps_bool(comment_in_first_line);
debug_ps_bool(comment_cont);
state.heading = "vertical spacing";
debug_ps_bool(break_after_comma);

View File

@ -1,4 +1,4 @@
/* $NetBSD: indent.h,v 1.198 2023/06/15 10:59:06 rillig Exp $ */
/* $NetBSD: indent.h,v 1.199 2023/06/16 11:27:49 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@ -383,10 +383,10 @@ extern struct parser_state {
/* Indentation of comments */
int comment_ind; /* indentation of the current comment */
int comment_ind; /* total indentation of the current comment */
int comment_shift; /* all but the first line of a boxed comment
* are shifted this much to the right */
bool comment_in_first_line;
bool comment_cont; /* after the first line of a comment */
/* Vertical spacing */

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.225 2023/06/15 11:27:36 rillig Exp $ */
/* $NetBSD: io.c,v 1.226 2023/06/16 11:27:49 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: io.c,v 1.225 2023/06/15 11:27:36 rillig Exp $");
__RCSID("$NetBSD: io.c,v 1.226 2023/06/16 11:27:49 rillig Exp $");
#include <stdio.h>
@ -300,9 +300,9 @@ output_comment(void)
int target_ind = ps.comment_ind;
const char *p;
if (!ps.comment_in_first_line)
if (ps.comment_cont)
target_ind += ps.comment_shift;
ps.comment_in_first_line = false;
ps.comment_cont = true;
/* consider the original indentation in case this is a box comment */
for (p = com.s; *p == '\t'; p++)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pr_comment.c,v 1.165 2023/06/14 14:11:28 rillig Exp $ */
/* $NetBSD: pr_comment.c,v 1.166 2023/06/16 11:27:49 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pr_comment.c,v 1.165 2023/06/14 14:11:28 rillig Exp $");
__RCSID("$NetBSD: pr_comment.c,v 1.166 2023/06/16 11:27:49 rillig Exp $");
#include <string.h>
@ -142,7 +142,7 @@ analyze_comment(bool *p_may_wrap, bool *p_delim, int *p_line_length)
static void
copy_comment_start(bool may_wrap, bool *delim, int line_length)
{
ps.comment_in_first_line = true;
ps.comment_cont = false;
com_add_char('/');
com_add_char(token.s[token.len - 1]); /* either '*' or '/' */