summaryrefslogtreecommitdiff
path: root/dtc-parser.y
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2007-07-07 01:18:51 -0500
committerJon Loeliger <jdl@freescale.com>2007-07-07 10:13:31 -0500
commit6a99b1313208d05ba6d9c5d3858230d9ee785f8c (patch)
tree62b09906809ee39b3f29a443fe4edafc10a0589c /dtc-parser.y
parentac6a5e26b4f2239d77eb4aa25383466833949006 (diff)
downloaddtc-6a99b1313208d05ba6d9c5d3858230d9ee785f8c.tar.gz
dtc: implement labels on property data
Extend the parser grammer to allow labels before or after any property data (string, cell list, or byte list), and any byte or cell within the property data. Store the labels using the same linked list structure as node references, but using a parallel list. When writing assembly output emit global labels as offsets from the start of the definition of the data. Note that the alignment for a cell list is done as part of the opening < delimiter, not the = or , before it. To label a cell after a string or byte list put the label inside the cell list. For example, prop = zero: [ aa bb ], two: < four: 1234 > eight: ; will produce labels with offsets 0, 2, 4, and 8 bytes from the beginning of the data for property prop. Signed-off-by: Milton Miller <miltonm@bga.com>
Diffstat (limited to 'dtc-parser.y')
-rw-r--r--dtc-parser.y4
1 files changed, 4 insertions, 0 deletions
diff --git a/dtc-parser.y b/dtc-parser.y
index d88cbf1..19bc58e 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -131,9 +131,11 @@ propdata: propdataprefix DT_STRING { $$ = data_merge($1, $2); }
$$ = 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: propdata ',' { $$ = $1; }
+ | propdataprefix DT_LABEL { $$ = data_add_label($1, $2); }
| /* empty */ { $$ = empty_data; }
;
@@ -150,10 +152,12 @@ celllist: celllist opt_cell_base DT_CELL {
| celllist DT_REF {
$$ = data_append_cell(data_add_fixup($1, $2), -1);
}
+ | 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; }
;