Module Name:    src
Committed By:   rillig
Date:           Sun Nov  7 07:45:00 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: fmt_decl.c token_comment.c
        src/usr.bin/indent: indent.c indent.h lexi.c

Log Message:
indent: rename type_at_paren_level_0 to type_outside_parentheses

For symmetry with type_in_parentheses.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/indent/token_comment.c
cvs rdiff -u -r1.211 -r1.212 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/indent/lexi.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/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.12 src/tests/usr.bin/indent/fmt_decl.c:1.13
--- src/tests/usr.bin/indent/fmt_decl.c:1.12	Sun Oct 31 19:20:53 2021
+++ src/tests/usr.bin/indent/fmt_decl.c	Sun Nov  7 07:45:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.12 2021/10/31 19:20:53 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.13 2021/11/07 07:45:00 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 
 /* See FreeBSD r303570 */
@@ -59,30 +59,30 @@ typedef struct Complex {
 
 
 /*
- * As of 2021-10-31, indent parses the following function definition as these
+ * As of 2021-11-07, indent parses the following function definition as these
  * tokens:
  *
- * line 1: type_at_paren_level_0 type "void"
+ * line 1: type_outside_parentheses "void"
  * line 1: newline "\n"
  * line 2: funcname "t1"
  * line 2: newline "\n"		repeated, see search_stmt
  * line 3: funcname "t1"	XXX: wrong line_no
  * line 3: lparen_or_lbracket "("
- * line 3: ident type "char"
+ * line 3: type_in_parentheses "char"
  * line 3: unary_op "*"
- * line 3: ident "a"
+ * line 3: word "a"
  * line 3: comma ","
- * line 3: ident type "int"
- * line 3: ident "b"
+ * line 3: type_in_parentheses "int"
+ * line 3: word "b"
  * line 3: comma ","
  * line 3: newline "\n"
- * line 4: ident type "void"
+ * line 4: type_in_parentheses "void"
  * line 4: lparen_or_lbracket "("
  * line 4: unary_op "*"
- * line 4: ident "fn"
+ * line 4: word "fn"
  * line 4: rparen_or_rbracket ")"
  * line 4: lparen_or_lbracket "("
- * line 4: ident type "void"
+ * line 4: type_in_parentheses "void"
  * line 4: rparen_or_rbracket ")"
  * line 4: rparen_or_rbracket ")"
  * line 4: newline "\n"

Index: src/tests/usr.bin/indent/token_comment.c
diff -u src/tests/usr.bin/indent/token_comment.c:1.18 src/tests/usr.bin/indent/token_comment.c:1.19
--- src/tests/usr.bin/indent/token_comment.c:1.18	Fri Nov  5 19:33:28 2021
+++ src/tests/usr.bin/indent/token_comment.c	Sun Nov  7 07:45:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token_comment.c,v 1.18 2021/11/05 19:33:28 rillig Exp $ */
+/* $NetBSD: token_comment.c,v 1.19 2021/11/07 07:45:00 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -954,7 +954,7 @@ f(void)
  * Test for an edge cases in comment handling, having a block comment inside
  * a line comment. Before NetBSD pr_comment.c 1.96 from 2021-11-04, indent
  * wrongly assumed that the comment would end at the '*' '/', tokenizing the
- * second word 'still' as a type_at_paren_level_0.
+ * second word 'still' as a type_outside_parentheses.
  */
 #indent input
 /* block comment */

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.211 src/usr.bin/indent/indent.c:1.212
--- src/usr.bin/indent/indent.c:1.211	Sun Nov  7 07:35:06 2021
+++ src/usr.bin/indent/indent.c	Sun Nov  7 07:44:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.211 2021/11/07 07:35:06 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.212 2021/11/07 07:44:59 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.211 2021/11/07 07:35:06 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.212 2021/11/07 07:44:59 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1507,7 +1507,7 @@ main_loop(void)
 	    if (ps.p_l_follow > 0)
 		goto copy_token;
 	    /* FALLTHROUGH */
-	case lsym_type_at_paren_level_0:
+	case lsym_type_outside_parentheses:
 	    process_type(&decl_ind, &tabs_to_var);
 	    goto copy_token;
 

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.80 src/usr.bin/indent/indent.h:1.81
--- src/usr.bin/indent/indent.h:1.80	Sun Nov  7 07:35:06 2021
+++ src/usr.bin/indent/indent.h	Sun Nov  7 07:44:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.80 2021/11/07 07:35:06 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.81 2021/11/07 07:44:59 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -91,7 +91,7 @@ typedef enum lexer_symbol {
     lsym_semicolon,
     lsym_typedef,
     lsym_storage_class,
-    lsym_type_at_paren_level_0,
+    lsym_type_outside_parentheses,
     lsym_type_in_parentheses,
     lsym_tag,			/* 'struct', 'union' or 'enum' */
     lsym_case_label,		/* 'case' or 'default' */

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.134 src/usr.bin/indent/lexi.c:1.135
--- src/usr.bin/indent/lexi.c:1.134	Sun Nov  7 07:35:06 2021
+++ src/usr.bin/indent/lexi.c	Sun Nov  7 07:44:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.134 2021/11/07 07:35:06 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.135 2021/11/07 07:44:59 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.134 2021/11/07 07:35:06 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.135 2021/11/07 07:44:59 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
  * While inside lexi_alnum, this constant just marks a type, independently of
  * the parentheses level.
  */
-#define lsym_type lsym_type_at_paren_level_0
+#define lsym_type lsym_type_outside_parentheses
 
 /* must be sorted alphabetically, is used in binary search */
 static const struct keyword {
@@ -238,7 +238,7 @@ lsym_name(lexer_symbol sym)
 	"semicolon",
 	"typedef",
 	"storage_class",
-	"type_at_paren_level_0",
+	"type_outside_parentheses",
 	"type_in_parentheses",
 	"tag",
 	"case_label",
@@ -490,7 +490,7 @@ lexi_alnum(void)
 
     if (ps.prev_token == lsym_tag && ps.p_l_follow == 0) {
 	ps.next_unary = true;
-	return lsym_type_at_paren_level_0;
+	return lsym_type_outside_parentheses;
     }
 
     /* Operator after identifier is binary unless last token was 'struct'. */
@@ -521,7 +521,7 @@ found_typename:
 	    if (kw != NULL && kw->lsym == lsym_tag)
 		return lsym_tag;
 	    if (ps.p_l_follow == 0)
-		return lsym_type_at_paren_level_0;
+		return lsym_type_outside_parentheses;
 	}
     }
 
@@ -540,7 +540,7 @@ no_function_definition:;
 
     } else if (probably_typename()) {
 	ps.next_unary = true;
-	return lsym_type_at_paren_level_0;
+	return lsym_type_outside_parentheses;
     }
 
     return is_type ? lsym_type_in_parentheses : lsym_word;

Reply via email to