Module Name:    src
Committed By:   rillig
Date:           Sun Oct 31 19:20:53 UTC 2021

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

Log Message:
indent: rename lsym_type to better reflect reality

Type names that occur in parentheses are parsed as lsym_ident having the
subtype kw_type instead.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.123 -r1.124 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.11 src/tests/usr.bin/indent/fmt_decl.c:1.12
--- src/tests/usr.bin/indent/fmt_decl.c:1.11	Sun Oct 31 19:13:41 2021
+++ src/tests/usr.bin/indent/fmt_decl.c	Sun Oct 31 19:20:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.11 2021/10/31 19:13:41 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.12 2021/10/31 19:20:53 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 
 /* See FreeBSD r303570 */
@@ -62,7 +62,7 @@ typedef struct Complex {
  * As of 2021-10-31, indent parses the following function definition as these
  * tokens:
  *
- * line 1: type type "void"
+ * line 1: type_at_paren_level_0 type "void"
  * line 1: newline "\n"
  * line 2: funcname "t1"
  * line 2: newline "\n"		repeated, see search_stmt

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.198 src/usr.bin/indent/indent.c:1.199
--- src/usr.bin/indent/indent.c:1.198	Sun Oct 31 10:09:43 2021
+++ src/usr.bin/indent/indent.c	Sun Oct 31 19:20:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.198 2021/10/31 10:09:43 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.199 2021/10/31 19:20:52 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.198 2021/10/31 10:09:43 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.199 2021/10/31 19:20:52 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1493,7 +1493,7 @@ main_loop(void)
 	    if (ps.p_l_follow > 0)
 		goto copy_token;
 	    /* FALLTHROUGH */
-	case lsym_type:
+	case lsym_type_at_paren_level_0:
 	    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.70 src/usr.bin/indent/indent.h:1.71
--- src/usr.bin/indent/indent.h:1.70	Sun Oct 31 10:09:43 2021
+++ src/usr.bin/indent/indent.h	Sun Oct 31 19:20:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.70 2021/10/31 10:09:43 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.71 2021/10/31 19:20:52 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,
+    lsym_type_at_paren_level_0,
     lsym_tag,			/* 'struct', 'union' or 'enum' */
     lsym_case_label,		/* 'case' or 'default' */
     lsym_string_prefix,		/* 'L' */

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.123 src/usr.bin/indent/lexi.c:1.124
--- src/usr.bin/indent/lexi.c:1.123	Sun Oct 31 19:13:41 2021
+++ src/usr.bin/indent/lexi.c	Sun Oct 31 19:20:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.123 2021/10/31 19:13:41 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.124 2021/10/31 19:20:52 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.123 2021/10/31 19:13:41 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.124 2021/10/31 19:20:52 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -232,7 +232,7 @@ lsym_name(lexer_symbol sym)
 	"semicolon",
 	"typedef",
 	"storage_class",
-	"type",
+	"type_at_paren_level_0",
 	"tag",
 	"case_label",
 	"string_prefix",
@@ -506,7 +506,7 @@ lexi_alnum(void)
 
     if (ps.prev_token == lsym_tag && ps.p_l_follow == 0) {
 	ps.next_unary = true;
-	return lsym_type;
+	return lsym_type_at_paren_level_0;
     }
 
     /* Operator after identifier is binary unless last token was 'struct'. */
@@ -553,7 +553,7 @@ found_typename:
 	    if (kw != NULL && kw->kind == kw_tag)
 		return lsym_tag;
 	    if (ps.p_l_follow == 0)
-		return lsym_type;
+		return lsym_type_at_paren_level_0;
 	}
     }
 
@@ -573,7 +573,7 @@ no_function_definition:;
     } else if (probably_typename()) {
 	ps.curr_keyword = kw_type;
 	ps.next_unary = true;
-	return lsym_type;
+	return lsym_type_at_paren_level_0;
     }
 
     return lsym_ident;		/* the ident is not in the list */

Reply via email to