Module Name:    src
Committed By:   rillig
Date:           Sun Jun  4 11:45:00 UTC 2023

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

Log Message:
indent: classify 'inline' as a modifier rather than a word


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/lsym_storage_class.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.320 -r1.321 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.208 -r1.209 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/lsym_storage_class.c
diff -u src/tests/usr.bin/indent/lsym_storage_class.c:1.4 src/tests/usr.bin/indent/lsym_storage_class.c:1.5
--- src/tests/usr.bin/indent/lsym_storage_class.c:1.4	Sun Apr 24 10:36:37 2022
+++ src/tests/usr.bin/indent/lsym_storage_class.c	Sun Jun  4 11:45:00 2023
@@ -1,8 +1,9 @@
-/* $NetBSD: lsym_storage_class.c,v 1.4 2022/04/24 10:36:37 rillig Exp $ */
+/* $NetBSD: lsym_storage_class.c,v 1.5 2023/06/04 11:45:00 rillig Exp $ */
 
 /*
- * Tests for the token lsym_storage_class, which represents a storage class as
- * part of a declaration.
+ * Tests for the token lsym_modifier (formerly named lsym_storage_class), which
+ * represents a type modifier such as 'const', a variable modifier such as a
+ * storage class, or a function modifier such as 'inline'.
  */
 
 //indent input

Index: src/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.28 src/usr.bin/indent/debug.c:1.29
--- src/usr.bin/indent/debug.c:1.28	Sun Jun  4 11:33:36 2023
+++ src/usr.bin/indent/debug.c	Sun Jun  4 11:45:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.28 2023/06/04 11:33:36 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.29 2023/06/04 11:45:00 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: debug.c,v 1.28 2023/06/04 11:33:36 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.29 2023/06/04 11:45:00 rillig Exp $");
 
 #include <stdarg.h>
 
@@ -66,7 +66,7 @@ const char *const lsym_name[] = {
 	"comma",
 	"semicolon",
 	"typedef",
-	"storage_class",
+	"modifier",
 	"type_outside_parentheses",
 	"type_in_parentheses",
 	"tag",

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.320 src/usr.bin/indent/indent.c:1.321
--- src/usr.bin/indent/indent.c:1.320	Sun Jun  4 11:33:36 2023
+++ src/usr.bin/indent/indent.c	Sun Jun  4 11:45:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.320 2023/06/04 11:33:36 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.321 2023/06/04 11:45:00 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.320 2023/06/04 11:33:36 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.321 2023/06/04 11:45:00 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -338,7 +338,7 @@ update_ps_decl_ptr(lexer_symbol lsym)
 {
 	switch (ps.decl_ptr) {
 	case dp_start:
-		if (lsym == lsym_storage_class)
+		if (lsym == lsym_modifier)
 			ps.decl_ptr = dp_start;
 		else if (lsym == lsym_type_outside_parentheses)
 			ps.decl_ptr = dp_word;
@@ -1187,7 +1187,7 @@ process_lsym(lexer_symbol lsym)
 		goto copy_token;
 
 	case lsym_typedef:
-	case lsym_storage_class:
+	case lsym_modifier:
 		goto copy_token;
 
 	case lsym_tag:

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.165 src/usr.bin/indent/indent.h:1.166
--- src/usr.bin/indent/indent.h:1.165	Sun Jun  4 11:33:36 2023
+++ src/usr.bin/indent/indent.h	Sun Jun  4 11:45:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.165 2023/06/04 11:33:36 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.166 2023/06/04 11:45:00 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -93,7 +93,7 @@ typedef enum lexer_symbol {
 	lsym_comma,
 	lsym_semicolon,
 	lsym_typedef,
-	lsym_storage_class,
+	lsym_modifier,		/* modifiers for types, functions, variables */
 	lsym_type_outside_parentheses,
 	lsym_type_in_parentheses,
 	lsym_tag,		/* 'struct', 'union' or 'enum' */

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.208 src/usr.bin/indent/lexi.c:1.209
--- src/usr.bin/indent/lexi.c:1.208	Sun Jun  4 11:33:36 2023
+++ src/usr.bin/indent/lexi.c	Sun Jun  4 11:45:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.208 2023/06/04 11:33:36 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.209 2023/06/04 11:45:00 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.208 2023/06/04 11:33:36 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.209 2023/06/04 11:45:00 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -47,7 +47,6 @@ __RCSID("$NetBSD: lexi.c,v 1.208 2023/06
 
 /* In lexi_alnum, this constant marks a type, independent of parentheses. */
 #define lsym_type lsym_type_outside_parentheses
-#define lsym_type_modifier lsym_storage_class
 
 /* must be sorted alphabetically, is used in binary search */
 static const struct keyword {
@@ -57,43 +56,43 @@ static const struct keyword {
 	{"_Bool", lsym_type},
 	{"_Complex", lsym_type},
 	{"_Imaginary", lsym_type},
-	{"auto", lsym_storage_class},
+	{"auto", lsym_modifier},
 	{"bool", lsym_type},
 	{"break", lsym_word},
 	{"case", lsym_case_label},
 	{"char", lsym_type},
 	{"complex", lsym_type},
-	{"const", lsym_type_modifier},
+	{"const", lsym_modifier},
 	{"continue", lsym_word},
 	{"default", lsym_case_label},
 	{"do", lsym_do},
 	{"double", lsym_type},
 	{"else", lsym_else},
 	{"enum", lsym_tag},
-	{"extern", lsym_storage_class},
+	{"extern", lsym_modifier},
 	{"float", lsym_type},
 	{"for", lsym_for},
 	{"goto", lsym_word},
 	{"if", lsym_if},
 	{"imaginary", lsym_type},
-	{"inline", lsym_word},
+	{"inline", lsym_modifier},
 	{"int", lsym_type},
 	{"long", lsym_type},
 	{"offsetof", lsym_offsetof},
-	{"register", lsym_storage_class},
+	{"register", lsym_modifier},
 	{"restrict", lsym_word},
 	{"return", lsym_return},
 	{"short", lsym_type},
 	{"signed", lsym_type},
 	{"sizeof", lsym_sizeof},
-	{"static", lsym_storage_class},
+	{"static", lsym_modifier},
 	{"struct", lsym_tag},
 	{"switch", lsym_switch},
 	{"typedef", lsym_typedef},
 	{"union", lsym_tag},
 	{"unsigned", lsym_type},
 	{"void", lsym_type},
-	{"volatile", lsym_type_modifier},
+	{"volatile", lsym_modifier},
 	{"while", lsym_while}
 };
 
@@ -254,7 +253,7 @@ lex_char_or_string(void)
 static bool
 probably_typename(void)
 {
-	if (ps.prev_token == lsym_storage_class)
+	if (ps.prev_token == lsym_modifier)
 		return true;
 	if (ps.block_init)
 		return false;

Reply via email to