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: classify 'inline' as a modifier rathe...



details:   https://anonhg.NetBSD.org/src/rev/a0aea2e814c1
branches:  trunk
changeset: 376195:a0aea2e814c1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 04 11:45:00 2023 +0000

description:
indent: classify 'inline' as a modifier rather than a word

diffstat:

 tests/usr.bin/indent/lsym_storage_class.c |   7 ++++---
 usr.bin/indent/debug.c                    |   6 +++---
 usr.bin/indent/indent.c                   |   8 ++++----
 usr.bin/indent/indent.h                   |   4 ++--
 usr.bin/indent/lexi.c                     |  21 ++++++++++-----------
 5 files changed, 23 insertions(+), 23 deletions(-)

diffs (183 lines):

diff -r e8b9d22de225 -r a0aea2e814c1 tests/usr.bin/indent/lsym_storage_class.c
--- a/tests/usr.bin/indent/lsym_storage_class.c Sun Jun 04 11:33:36 2023 +0000
+++ b/tests/usr.bin/indent/lsym_storage_class.c Sun Jun 04 11:45:00 2023 +0000
@@ -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
diff -r e8b9d22de225 -r a0aea2e814c1 usr.bin/indent/debug.c
--- a/usr.bin/indent/debug.c    Sun Jun 04 11:33:36 2023 +0000
+++ b/usr.bin/indent/debug.c    Sun Jun 04 11:45:00 2023 +0000
@@ -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",
diff -r e8b9d22de225 -r a0aea2e814c1 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sun Jun 04 11:33:36 2023 +0000
+++ b/usr.bin/indent/indent.c   Sun Jun 04 11:45:00 2023 +0000
@@ -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:
diff -r e8b9d22de225 -r a0aea2e814c1 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Sun Jun 04 11:33:36 2023 +0000
+++ b/usr.bin/indent/indent.h   Sun Jun 04 11:45:00 2023 +0000
@@ -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' */
diff -r e8b9d22de225 -r a0aea2e814c1 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Sun Jun 04 11:33:36 2023 +0000
+++ b/usr.bin/indent/lexi.c     Sun Jun 04 11:45:00 2023 +0000
@@ -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 @@
 
 /* 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;



Home | Main Index | Thread Index | Old Index