Module Name:    src
Committed By:   rillig
Date:           Sun Mar  7 17:57:52 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.163 src/usr.bin/xlint/lint1/cgram.y:1.164
--- src/usr.bin/xlint/lint1/cgram.y:1.163	Sat Feb 20 16:03:56 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Mar  7 17:57:52 2021
@@ -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 @@ anonymize(sym_t *s)
 %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:
 	| 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);
 	  }
 	;
 

Reply via email to