From: Jon Loeliger <jdl@jdl•com>
To: linuxppc-dev@ozlabs•org
Subject: [PATCH 1/4] DTC: Reformat grammar rules to not mix language syntax and yacc syntax.
Date: Fri, 19 Oct 2007 12:42:32 -0500 [thread overview]
Message-ID: <E1Iivrk-000784-OB@jdl.com> (raw)
Use consistent indenting on all rule actions.
Signed-off-by: Jon Loeliger <jdl@freescale•com>
---
No functional changes!
dtc-parser.y | 152 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 118 insertions(+), 34 deletions(-)
diff --git a/dtc-parser.y b/dtc-parser.y
index 54fd787..4698793 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -79,103 +79,187 @@ extern struct boot_info *the_boot_info;
%%
-sourcefile: memreserves devicetree {
+sourcefile:
+ memreserves devicetree
+ {
the_boot_info = build_boot_info($1, $2);
}
;
-memreserves: memreserve memreserves {
+memreserves:
+ memreserve memreserves
+ {
$$ = chain_reserve_entry($1, $2);
}
- | /* empty */ {
+ | /* empty */
+ {
$$ = NULL;
}
;
-memreserve: label DT_MEMRESERVE DT_ADDR DT_ADDR ';' {
+memreserve:
+ label DT_MEMRESERVE DT_ADDR DT_ADDR ';'
+ {
$$ = build_reserve_entry($3, $4, $1);
}
- | label DT_MEMRESERVE DT_ADDR '-' DT_ADDR ';' {
+ | label DT_MEMRESERVE DT_ADDR '-' DT_ADDR ';'
+ {
$$ = build_reserve_entry($3, $5 - $3 + 1, $1);
}
;
-devicetree: '/' nodedef {
+devicetree:
+ '/' nodedef
+ {
$$ = name_node($2, "", NULL);
}
;
-nodedef: '{' proplist subnodes '}' ';' {
+nodedef:
+ '{' proplist subnodes '}' ';'
+ {
$$ = build_node($2, $3);
}
;
-proplist: propdef proplist {
+proplist:
+ propdef proplist
+ {
$$ = chain_property($1, $2);
}
- | /* empty */ {
+ | /* empty */
+ {
$$ = NULL;
}
;
-propdef: label DT_PROPNAME '=' propdata ';' {
+propdef:
+ label DT_PROPNAME '=' propdata ';'
+ {
$$ = build_property($2, $4, $1);
}
- | label DT_PROPNAME ';' {
+ | label DT_PROPNAME ';'
+ {
$$ = build_property($2, empty_data, $1);
}
;
-propdata: propdataprefix DT_STRING { $$ = data_merge($1, $2); }
- | propdataprefix '<' celllist '>' {
- $$ = data_merge(data_append_align($1, sizeof(cell_t)), $3);
+propdata:
+ propdataprefix DT_STRING
+ {
+ $$ = data_merge($1, $2);
+ }
+ | propdataprefix '<' celllist '>'
+ {
+ $$ = data_merge(data_append_align($1,
+ sizeof(cell_t)), $3);
+ }
+ | propdataprefix '[' bytestring ']'
+ {
+ $$ = data_merge($1, $3);
+ }
+ | propdata DT_LABEL
+ {
+ $$ = data_add_label($1, $2);
}
- | propdataprefix '[' bytestring ']' { $$ = data_merge($1, $3); }
- | propdata DT_LABEL { $$ = data_add_label($1, $2); }
;
-propdataprefix: propdata ',' { $$ = $1; }
- | propdataprefix DT_LABEL { $$ = data_add_label($1, $2); }
- | /* empty */ { $$ = empty_data; }
+propdataprefix:
+ propdata ','
+ {
+ $$ = $1;
+ }
+ | propdataprefix DT_LABEL
+ {
+ $$ = data_add_label($1, $2);
+ }
+ | /* empty */
+ {
+ $$ = empty_data;
+ }
;
opt_cell_base:
/* empty */
- { $$ = 16; }
+ {
+ $$ = 16;
+ }
| DT_BASE
;
-celllist: celllist opt_cell_base DT_CELL {
+celllist:
+ celllist opt_cell_base DT_CELL
+ {
$$ = data_append_cell($1,
cell_from_string($3, $2));
}
- | celllist DT_REF {
+ | celllist DT_REF
+ {
$$ = data_append_cell(data_add_fixup($1, $2), -1);
}
- | celllist DT_LABEL { $$ = data_add_label($1, $2); }
- | /* empty */ { $$ = empty_data; }
+ | celllist DT_LABEL
+ {
+ $$ = data_add_label($1, $2);
+ }
+ | /* empty */
+ {
+ $$ = empty_data;
+ }
;
-bytestring: bytestring DT_BYTE { $$ = data_append_byte($1, $2); }
- | bytestring DT_LABEL { $$ = data_add_label($1, $2); }
- | /* empty */ { $$ = empty_data; }
+bytestring:
+ bytestring DT_BYTE
+ {
+ $$ = data_append_byte($1, $2);
+ }
+ | bytestring DT_LABEL
+ {
+ $$ = data_add_label($1, $2);
+ }
+ | /* empty */
+ {
+ $$ = empty_data;
+ }
;
-subnodes: subnode subnodes {
+subnodes:
+ subnode subnodes
+ {
$$ = chain_node($1, $2);
}
- | /* empty */ { $$ = NULL; }
+ | /* empty */
+ {
+ $$ = NULL;
+ }
;
-subnode: label nodename nodedef { $$ = name_node($3, $2, $1); }
+subnode:
+ label nodename nodedef
+ {
+ $$ = name_node($3, $2, $1);
+ }
;
-nodename: DT_NODENAME { $$ = $1; }
- | DT_PROPNAME { $$ = $1; }
+nodename:
+ DT_NODENAME
+ {
+ $$ = $1;
+ }
+ | DT_PROPNAME
+ {
+ $$ = $1;
+ }
;
-label: DT_LABEL { $$ = $1; }
- | /* empty */ { $$ = NULL; }
+label:
+ DT_LABEL
+ {
+ $$ = $1;
+ }
+ | /* empty */
+ {
+ $$ = NULL;
+ }
;
%%
--
1.5.3.1.139.g9346b
next reply other threads:[~2007-10-19 17:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-19 17:42 Jon Loeliger [this message]
2007-10-20 7:12 ` [PATCH 1/4] DTC: Reformat grammar rules to not mix language syntax and yacc syntax David Gibson
2007-10-22 16:41 ` Jon Loeliger
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=E1Iivrk-000784-OB@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