Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/indent indent: rename a field of the parser state
details: https://anonhg.NetBSD.org/src/rev/2ac8c7861d25
branches: trunk
changeset: 376402:2ac8c7861d25
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jun 16 11:27:49 2023 +0000
description:
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.
diffstat:
usr.bin/indent/debug.c | 6 +++---
usr.bin/indent/indent.h | 6 +++---
usr.bin/indent/io.c | 8 ++++----
usr.bin/indent/pr_comment.c | 6 +++---
4 files changed, 13 insertions(+), 13 deletions(-)
diffs (106 lines):
diff -r a3168b5ffd7c -r 2ac8c7861d25 usr.bin/indent/debug.c
--- a/usr.bin/indent/debug.c Fri Jun 16 11:27:00 2023 +0000
+++ b/usr.bin/indent/debug.c Fri Jun 16 11:27:49 2023 +0000
@@ -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);
diff -r a3168b5ffd7c -r 2ac8c7861d25 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h Fri Jun 16 11:27:00 2023 +0000
+++ b/usr.bin/indent/indent.h Fri Jun 16 11:27:49 2023 +0000
@@ -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 */
diff -r a3168b5ffd7c -r 2ac8c7861d25 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c Fri Jun 16 11:27:00 2023 +0000
+++ b/usr.bin/indent/io.c Fri Jun 16 11:27:49 2023 +0000
@@ -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++)
diff -r a3168b5ffd7c -r 2ac8c7861d25 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c Fri Jun 16 11:27:00 2023 +0000
+++ b/usr.bin/indent/pr_comment.c Fri Jun 16 11:27:49 2023 +0000
@@ -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 *
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 '/' */
Home |
Main Index |
Thread Index |
Old Index