linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] DTC: Rewrite the propdata and propdataprefix rules.
@ 2007-10-22 22:01 Jon Loeliger
  2007-10-22 22:37 ` Jon Loeliger
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Loeliger @ 2007-10-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev


After staring at these two rules for a bit, and not quite
groking them, I rewrote them into something I think is a
bit clearer.  With any luck, it's the same language still.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
---

You be the judge too!

 dtc-parser.y |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/dtc-parser.y b/dtc-parser.y
index 61ed250..f0b0178 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -59,7 +59,6 @@ extern struct boot_info *the_boot_info;
 %token <str> DT_REF
 
 %type <data> propdata
-%type <data> propdataprefix
 %type <re> memreserve
 %type <re> memreserves
 %type <cbase> opt_cell_base
@@ -143,37 +142,35 @@ propdef:
 	;
 
 propdata:
-	  propdataprefix DT_STRING
+	  DT_STRING
 		{
-			$$ = data_merge($1, $2);
+			$$ = data_merge(empty_data, $1);
 		}
-	| propdataprefix '<' celllist '>'
+	| '<' celllist '>'
 		{
-			$$ = data_merge(data_append_align($1,
-							  sizeof(cell_t)), $3);
+			$$ = data_merge(data_append_align(empty_data,
+							  sizeof(cell_t)), $2);
 		}
-	| propdataprefix '[' bytestring ']'
+	| '[' bytestring ']'
 		{
-			$$ = data_merge($1, $3);
+			$$ = data_merge(empty_data, $2);
 		}
 	| propdata DT_LABEL
 		{
 			$$ = data_add_label($1, $2);
 		}
-	;
-
-propdataprefix:
-	  /* empty */
+	| propdata ',' DT_STRING
 		{
-			$$ = empty_data;
+			$$ = data_merge($1, $3);
 		}
-	| propdata ','
+	| propdata ',' '<' celllist '>'
 		{
-			$$ = $1;
+			$$ = data_merge(data_append_align($1,
+							  sizeof(cell_t)), $4);
 		}
-	| propdataprefix DT_LABEL
+	| propdata ',' '[' bytestring ']'
 		{
-			$$ = data_add_label($1, $2);
+			$$ = data_merge($1, $4);
 		}
 	;
 
-- 
1.5.3.1.139.g9346b

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] DTC: Rewrite the propdata and propdataprefix rules.
  2007-10-22 22:01 [PATCH] DTC: Rewrite the propdata and propdataprefix rules Jon Loeliger
@ 2007-10-22 22:37 ` Jon Loeliger
  2007-10-23  0:38   ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Loeliger @ 2007-10-22 22:37 UTC (permalink / raw)
  To: linuxppc-dev

So, like, the other day Jon Loeliger mumbled:
> 
> After staring at these two rules for a bit, and not quite
> groking them, I rewrote them into something I think is a
> bit clearer.  With any luck, it's the same language still.
> 
> Signed-off-by: Jon Loeliger <jdl@freescale.com>
> ---
> 
> You be the judge too!

Yeah, so, I botched this one.  It's NOT the same
language, so don't apply it or think about it at all...

jdl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] DTC: Rewrite the propdata and propdataprefix rules.
  2007-10-22 22:37 ` Jon Loeliger
@ 2007-10-23  0:38   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2007-10-23  0:38 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

On Mon, Oct 22, 2007 at 05:37:57PM -0500, Jon Loeliger wrote:
> So, like, the other day Jon Loeliger mumbled:
> > 
> > After staring at these two rules for a bit, and not quite
> > groking them, I rewrote them into something I think is a
> > bit clearer.  With any luck, it's the same language still.
> > 
> > Signed-off-by: Jon Loeliger <jdl@freescale.com>
> > ---
> > 
> > You be the judge too!
> 
> Yeah, so, I botched this one.  It's NOT the same
> language, so don't apply it or think about it at all...

Yeah, I remember finding the whole propdataprefix confusing myself.
But the form was suggested by someone (forgotten whom now), and I
never did figure out a better way of doing it.

-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-23  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 22:01 [PATCH] DTC: Rewrite the propdata and propdataprefix rules Jon Loeliger
2007-10-22 22:37 ` Jon Loeliger
2007-10-23  0:38   ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).