Module Name: src
Committed By: rillig
Date: Wed Jun 14 08:25:15 UTC 2023
Modified Files:
src/tests/usr.bin/indent: lsym_binary_op.c
src/usr.bin/indent: debug.c indent.h lexi.c pr_comment.c
Log Message:
indent: remove a redundant flag from the parser state
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/lsym_binary_op.c
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.161 -r1.162 src/usr.bin/indent/pr_comment.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/indent/lsym_binary_op.c
diff -u src/tests/usr.bin/indent/lsym_binary_op.c:1.11 src/tests/usr.bin/indent/lsym_binary_op.c:1.12
--- src/tests/usr.bin/indent/lsym_binary_op.c:1.11 Sun Jun 4 22:57:18 2023
+++ src/tests/usr.bin/indent/lsym_binary_op.c Wed Jun 14 08:25:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_binary_op.c,v 1.11 2023/06/04 22:57:18 rillig Exp $ */
+/* $NetBSD: lsym_binary_op.c,v 1.12 2023/06/14 08:25:15 rillig Exp $ */
/*
* Tests for the token lsym_binary_op, which represents a binary operator in
@@ -147,7 +147,7 @@ joined_unary_and_binary_operators(void)
* Ensure that the result of the indentation does not depend on whether a
* token from the input starts in column 1 or 9.
*
- * See process_binary_op, ps.curr_col_1.
+ * See process_binary_op.
*/
//indent input
int col_1 //
Index: src/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.54 src/usr.bin/indent/debug.c:1.55
--- src/usr.bin/indent/debug.c:1.54 Wed Jun 14 07:20:55 2023
+++ src/usr.bin/indent/debug.c Wed Jun 14 08:25:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.54 2023/06/14 07:20:55 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.55 2023/06/14 08:25:15 rillig Exp $ */
/*-
* Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: debug.c,v 1.54 2023/06/14 07:20:55 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.55 2023/06/14 08:25:15 rillig Exp $");
#include <stdarg.h>
#include <string.h>
@@ -375,7 +375,6 @@ debug_parser_state(void)
debug_ps_bool(blank_line_after_decl);
state.heading = "comments";
- debug_ps_bool(curr_col_1);
debug_ps_bool(next_col_1);
state.heading = NULL;
Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.189 src/usr.bin/indent/indent.h:1.190
--- src/usr.bin/indent/indent.h:1.189 Wed Jun 14 07:20:55 2023
+++ src/usr.bin/indent/indent.h Wed Jun 14 08:25:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.h,v 1.189 2023/06/14 07:20:55 rillig Exp $ */
+/* $NetBSD: indent.h,v 1.190 2023/06/14 08:25:15 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -405,9 +405,8 @@ extern struct parser_state {
/* Comments */
- bool curr_col_1; /* whether the current token started in column
- * 1 of the original input */
- bool next_col_1;
+ bool next_col_1; /* whether the next token starts in column 1 of
+ * the original input */
} ps;
extern struct output_state {
Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.225 src/usr.bin/indent/lexi.c:1.226
--- src/usr.bin/indent/lexi.c:1.225 Sat Jun 10 16:43:56 2023
+++ src/usr.bin/indent/lexi.c Wed Jun 14 08:25:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lexi.c,v 1.225 2023/06/10 16:43:56 rillig Exp $ */
+/* $NetBSD: lexi.c,v 1.226 2023/06/14 08:25:15 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.225 2023/06/10 16:43:56 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.226 2023/06/14 08:25:15 rillig Exp $");
#include <stdlib.h>
#include <string.h>
@@ -532,14 +532,12 @@ lexer_symbol
lexi(void)
{
buf_clear(&token);
- ps.curr_col_1 = ps.next_col_1;
ps.next_col_1 = false;
for (;;) {
- if (ch_isblank(inp_p[0])) {
- ps.curr_col_1 = false;
+ if (ch_isblank(inp_p[0]))
inp_p++;
- } else if (inp_p[0] == '\\' && inp_p[1] == '\n') {
+ else if (inp_p[0] == '\\' && inp_p[1] == '\n') {
inp_p++;
inp_skip();
line_no++;
Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.161 src/usr.bin/indent/pr_comment.c:1.162
--- src/usr.bin/indent/pr_comment.c:1.161 Sat Jun 10 16:43:56 2023
+++ src/usr.bin/indent/pr_comment.c Wed Jun 14 08:25:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_comment.c,v 1.161 2023/06/10 16:43:56 rillig Exp $ */
+/* $NetBSD: pr_comment.c,v 1.162 2023/06/14 08:25:15 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pr_comment.c,v 1.161 2023/06/10 16:43:56 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.162 2023/06/14 08:25:15 rillig Exp $");
#include <string.h>
@@ -84,7 +84,7 @@ analyze_comment(bool *p_may_wrap, bool *
int ind;
int line_length = opt.max_line_length;
- if (ps.curr_col_1 && !opt.format_col1_comments) {
+ if (inp_p - inp.s == 2 && !opt.format_col1_comments) {
may_wrap = false;
ind = 0;
} else {