public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Jon Loeliger <jdl@jdl•com>
To: linuxppc-dev@ozlabs•org
Subject: [PATCH] DTC: Rewrite the propdata and propdataprefix rules.
Date: Mon, 22 Oct 2007 17:01:56 -0500	[thread overview]
Message-ID: <E1Ik5LQ-0000Ef-UF@jdl.com> (raw)


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

             reply	other threads:[~2007-10-22 22:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 22:01 Jon Loeliger [this message]
2007-10-22 22:37 ` [PATCH] DTC: Rewrite the propdata and propdataprefix rules Jon Loeliger
2007-10-23  0:38   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Ik5LQ-0000Ef-UF@jdl.com \
    --to=jdl@jdl$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox