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: rename lsym_type to better reflect re...



details:   https://anonhg.NetBSD.org/src/rev/36fa6ab174e0
branches:  trunk
changeset: 1024712:36fa6ab174e0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 31 19:20:52 2021 +0000

description:
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.

diffstat:

 tests/usr.bin/indent/fmt_decl.c |   4 ++--
 usr.bin/indent/indent.c         |   6 +++---
 usr.bin/indent/indent.h         |   4 ++--
 usr.bin/indent/lexi.c           |  12 ++++++------
 4 files changed, 13 insertions(+), 13 deletions(-)

diffs (117 lines):

diff -r 3fd8a2d5bd99 -r 36fa6ab174e0 tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c   Sun Oct 31 19:13:41 2021 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c   Sun Oct 31 19:20:52 2021 +0000
@@ -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 @@
  * 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
diff -r 3fd8a2d5bd99 -r 36fa6ab174e0 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sun Oct 31 19:13:41 2021 +0000
+++ b/usr.bin/indent/indent.c   Sun Oct 31 19:20:52 2021 +0000
@@ -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 @@
 
 #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 @@
            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;
 
diff -r 3fd8a2d5bd99 -r 36fa6ab174e0 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Sun Oct 31 19:13:41 2021 +0000
+++ b/usr.bin/indent/indent.h   Sun Oct 31 19:20:52 2021 +0000
@@ -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 @@
     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' */
diff -r 3fd8a2d5bd99 -r 36fa6ab174e0 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Sun Oct 31 19:13:41 2021 +0000
+++ b/usr.bin/indent/lexi.c     Sun Oct 31 19:20:52 2021 +0000
@@ -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 @@
 
 #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 @@
        "semicolon",
        "typedef",
        "storage_class",
-       "type",
+       "type_at_paren_level_0",
        "tag",
        "case_label",
        "string_prefix",
@@ -506,7 +506,7 @@
 
     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 @@
            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 @@
     } 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 */



Home | Main Index | Thread Index | Old Index