Skip to contentSkip to conversation

DTC: Minor grammar rule shuffle.

PATCH In review Jon Loeliger 2 participants 2 messages Oct 22, 2007 – Oct 23, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DTC: Minor grammar rule shuffle.

I like to see the basis cases established early in the rule sets, so place "empty" reduction first. Purely cosmetic.

---
 dtc-parser.y |   62 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 31 insertions(+), 31 deletions(-)
dtc-parser.y +31 -31
index 0d140e5..c213526 100644
@@ -86,13 +86,13 @@ sourcefile:
 	;
 
 memreserves:
-	  memreserve memreserves
+	  /* empty */
 		{
-			$$ = chain_reserve_entry($1, $2);
+			$$ = NULL;
 		}
-	| /* empty */
+	| memreserve memreserves
 		{
-			$$ = NULL;
+			$$ = chain_reserve_entry($1, $2);
 		}
 	;
 
@@ -122,13 +122,13 @@ nodedef:
 	;
 
 proplist:
-	  proplist propdef
+	  /* empty */
 		{
-			$$ = chain_property($2, $1);
+			$$ = NULL;
 		}
-	| /* empty */
+	| proplist propdef
 		{
-			$$ = NULL;
+			$$ = chain_property($2, $1);
 		}
 	;
 
@@ -164,7 +164,11 @@ propdata:
 	;
 
 propdataprefix:
-	  propdata ','
+	  /* empty */
+		{
+			$$ = empty_data;
+		}
+	| propdata ','
 		{
 			$$ = $1;
 		}
@@ -172,10 +176,6 @@ propdataprefix:
 		{
 			$$ = data_add_label($1, $2);
 		}
-	| /* empty */
-		{
-			$$ = empty_data;
-		}
 	;
 
 opt_cell_base:
@@ -187,7 +187,11 @@ opt_cell_base:
 	;
 
 celllist:
-	  celllist opt_cell_base DT_CELL
+	  /* empty */
+		{
+			$$ = empty_data;
+		}
+	| celllist opt_cell_base DT_CELL
 		{
 			$$ = data_append_cell($1,
 					      cell_from_string($3, $2));
@@ -200,14 +204,14 @@ celllist:
 		{
 			$$ = data_add_label($1, $2);
 		}
-	| /* empty */
-		{
-			$$ = empty_data;
-		}
 	;
 
 bytestring:
-	  bytestring DT_BYTE
+	  /* empty */
+		{
+			$$ = empty_data;
+		}
+	| bytestring DT_BYTE
 		{
 			$$ = data_append_byte($1, $2);
 		}
@@ -215,20 +219,16 @@ bytestring:
 		{
 			$$ = data_add_label($1, $2);
 		}
-	| /* empty */
-		{
-			$$ = empty_data;
-		}
 	;
 
 subnodes:
-	  subnode subnodes
+	  /* empty */
 		{
-			$$ = chain_node($1, $2);
+			$$ = NULL;
 		}
-	| /* empty */
+	|  subnode subnodes
 		{
-			$$ = NULL;
+			$$ = chain_node($1, $2);
 		}
 	;
 
@@ -251,13 +251,13 @@ nodename:
 	;
 
 label:
-	  DT_LABEL
+	  /* empty */
 		{
-			$$ = $1;
+			$$ = NULL;
 		}
-	| /* empty */
+	| DT_LABEL
 		{
-			$$ = NULL;
+			$$ = $1;
 		}
 	;
 
Signature · 1 line
1.5.3.1.139.g9346b
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jon Loeliger

I like to see the basis cases established early in the rule sets, so place "empty" reduction first. Purely cosmetic.

As with the change of { } formatting, I don't really care much either way on this one. So

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson