[PATCH 09/10] Re-implement "," in property definitions as a bytestring operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxxxxxxxxx>
---
 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" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux