From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from jdl.com (jdl.com [208.123.74.7]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTP id 9336ADDE33 for ; Tue, 23 Oct 2007 08:02:00 +1000 (EST) Received: from jdl (helo=jdl.com) by jdl.com with local-esmtp (Exim 4.63) (envelope-from ) id 1Ik5LQ-0000Ef-UF for linuxppc-dev@ozlabs.org; Mon, 22 Oct 2007 17:01:57 -0500 To: linuxppc-dev@ozlabs.org Subject: [PATCH] DTC: Rewrite the propdata and propdataprefix rules. Date: Mon, 22 Oct 2007 17:01:56 -0500 From: Jon Loeliger Message-Id: List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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 DT_REF %type propdata -%type propdataprefix %type memreserve %type memreserves %type 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