[PATCH v2 3/3] dtc: Support character literals in bytestrings

Jon Loeliger jdl at jdl.com
Sat Sep 10 00:22:37 EST 2011


> > > >     property = ['a' 2b '\r'];
> > > > 
> > > >     property = [61 2b 0d];

> > Does it matter much?  I'm happy with either.  Is there a downside to
> > the first syntax?
> 
> Well.. probably not.  I'm just nervous about adding anything in the
> lexically weird bytestring context.

As a general statement, it is often difficult for parsers
to establish enough look-ahead when lists of things are
simply placed side-by-side without some sort of connecting
syntax.  So a structure like "foo1 foo2 foo3" can be more prone
to S/R and R/R errors than something like "foo1, foo2, foo3".
No, that's not a hard and fast rule because prior context
can make it clear to a parsing rule set.  In this case,
the '[' can estabish that context and make it clear what
is intended as a list of values.  But if there were ever
any future notion of wanting to create a bracketed list
of values for another purpose, then a comma separated list
would be preferable.

jdl


More information about the devicetree-discuss mailing list