Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: inline 'case 3...5' in grammar



details:   https://anonhg.NetBSD.org/src/rev/27b8c6f301c8
branches:  trunk
changeset: 953384:27b8c6f301c8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 07 17:57:52 2021 +0000

description:
lint: inline 'case 3...5' in grammar

There was no point in having a separate grammar rule for the '3...' part
of a range expression, it just made the code more complicated than
necessary.

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diffs (50 lines):

diff -r 6a9c2cd6876b -r 27b8c6f301c8 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Mar 07 17:12:41 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Mar 07 17:57:52 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.163 2021/02/20 16:03:56 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.164 2021/03/07 17:57:52 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.163 2021/02/20 16:03:56 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.164 2021/03/07 17:57:52 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -329,7 +329,6 @@
 %type  <y_string>      string2
 %type  <y_sb>          opt_asm_or_symbolrename
 %type  <y_range>       range
-%type  <y_range>       low_range
 
 
 %%
@@ -1346,19 +1345,14 @@
        | init_expr_list T_COMMA init_assign_expr
        ;
 
-low_range:
-         constant T_ELLIPSIS {
-               $$.lo = toicon($1, 1);
-         }
-       ;
 range:
          constant {
                $$.lo = toicon($1, 1);
                $$.hi = $$.lo + 1;
          }
-       | low_range constant {
-               $$.lo = $1.lo;
-               $$.hi = toicon($2, 1);
+       | constant T_ELLIPSIS constant {
+               $$.lo = toicon($1, 1);
+               $$.hi = toicon($3, 1);
          }
        ;
 



Home | Main Index | Thread Index | Old Index