devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: jdl-CYoMK+44s/E@public.gmane.org,
	3fa55604225d40864c30a8b17d0dac60b2384cbe-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	David Gibson
	<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Subject: [PATCH 09/10] Re-implement "," in property definitions as a bytestring operator
Date: Mon, 17 Feb 2014 00:19:40 +1100	[thread overview]
Message-ID: <1392556781-7743-10-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1392556781-7743-1-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>

We've already introduced an internal "join" operator which appends
bytestring expressions together.  This uses it to implement the "," syntax
in property values as expressions.

This is the last piece of property value syntax to be converted to use
the expression infrastructure, so all (non-empty) property values can now
be implemented as a single expression.  For now we still just immediately
evaluate the expression though.

Signed-off-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
---
 dtc-parser.y | 37 ++++++++++++++-----------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/dtc-parser.y b/dtc-parser.y
index 7e1251d..61cdf66 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -76,8 +76,6 @@ static struct data expr_bytestring(struct expression *expr);
 %token <labelref> DT_REF
 %token DT_INCBIN
 
-%type <data> propdata
-%type <data> propdataprefix
 %type <re> memreserve
 %type <re> memreserves
 %type <array> array
@@ -107,6 +105,7 @@ static struct data expr_bytestring(struct expression *expr);
 %type <expr> expr_or
 %type <expr> expr_conditional
 %type <expr> expr_postlabel
+%type <expr> expr_join
 %type <expr> expr
 
 %%
@@ -194,9 +193,11 @@ proplist:
 	;
 
 propdef:
-	  DT_PROPNODENAME '=' propdata ';'
+	  DT_PROPNODENAME '=' expr ';'
 		{
-			$$ = build_property($1, $3);
+			struct data d = expr_bytestring($3);
+
+			$$ = build_property($1, d);
 		}
 	| DT_PROPNODENAME ';'
 		{
@@ -213,25 +214,6 @@ propdef:
 		}
 	;
 
-propdata:
-	  propdataprefix expr
-		{
-			struct data d = expr_bytestring($2);
-			$$ = data_merge($1, d);
-		}
-	;
-
-propdataprefix:
-	  /* empty */
-		{
-			$$ = empty_data;
-		}
-	| propdata ','
-		{
-			$$ = $1;
-		}
-	;
-
 array:
 	  arrayprefix '>'	{ $$ = $1; }
 	;
@@ -328,7 +310,15 @@ expr_prim:
 	;
 
 expr:
+	  expr_join
+	;
+
+expr_join:
 	  expr_postlabel
+	| expr_join ',' expr_postlabel
+		{
+			$$ = expression_join(&@$, $1, $3);
+		}
 	;
 
 expr_postlabel:
@@ -343,6 +333,7 @@ expr_postlabel:
 		}
 	;
 
+
 expr_conditional:
 	  expr_or
 	| DT_REF
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-02-16 13:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-16 13:19 [0/10] RFC: A new start on richer dtc expression support David Gibson
     [not found] ` <1392556781-7743-1-git-send-email-david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
2014-02-16 13:19   ` [PATCH 01/10] First cut at expression trees David Gibson
2014-02-16 13:19   ` [PATCH 02/10] Add srcpos information to expressions David Gibson
2014-02-16 13:19   ` [PATCH 03/10] Add type information to expression trees David Gibson
2014-02-16 13:19   ` [PATCH 04/10] Add string and bytestring expression types David Gibson
2014-02-16 13:19   ` [PATCH 05/10] Integrate /incbin/ with expanded expressions David Gibson
2014-02-16 13:19   ` [PATCH 06/10] Implement arrays as expressions David Gibson
2014-02-16 13:19   ` [PATCH 07/10] Implement labels within property values as bytestring expressions David Gibson
2014-02-16 13:19   ` [PATCH 08/10] Implement path references in terms of " David Gibson
2014-02-16 13:19   ` David Gibson [this message]
2014-02-16 13:19   ` [PATCH 10/10] Implement string concatenate and repeat operators 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=1392556781-7743-10-git-send-email-david@gibson.dropbear.id.au \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=3fa55604225d40864c30a8b17d0dac60b2384cbe-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jdl-CYoMK+44s/E@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).