[PATCH v3 2/3] dtc: Support character literals in cell lists

Anton Staaf robotboy at google.com
Sat Sep 10 01:30:23 EST 2011


On Fri, Sep 9, 2011 at 12:03 AM, David Gibson
<david at gibson.dropbear.id.au> wrote:
> On Thu, Sep 08, 2011 at 11:40:59PM -0700, Anton Staaf wrote:
>> On Thu, Sep 8, 2011 at 6:12 PM, David Gibson
>> <david at gibson.dropbear.id.au> wrote:
>> > On Thu, Sep 08, 2011 at 02:39:16PM -0700, Anton Staaf wrote:
>> >> With this patch the following property assignment:
>> >>
>> >>     property = <0x12345678 'a' '\r' 100>;
>> >>
>> >> is equivalent to:
>> >>
>> >>     property = <0x12345678 0x00000061 0x0000000D 0x00000064>
>> >
>> > One tiny nit..
>> >
>> > [snip]
>> >> diff --git a/dtc-lexer.l b/dtc-lexer.l
>> >> index e866ea5..94151da 100644
>> >> --- a/dtc-lexer.l
>> >> +++ b/dtc-lexer.l
>> >> @@ -29,6 +29,7 @@ PROPNODECHAR        [a-zA-Z0-9,._+*#?@-]
>> >>  PATHCHAR     ({PROPNODECHAR}|[/])
>> >>  LABEL                [a-zA-Z_][a-zA-Z0-9_]*
>> >>  STRING               \"([^\\"]|\\.)*\"
>> >> +CHAR_LITERAL '[^']+'|'\\''
>> >
>> > I think this should be
>> >        '([^']|\\')*'
>> >
>> > On the same grounds I described before.  That does mean
>> > eval_char_literal() will have to cope with the case of ''.
>>
>> OK, I could also make it '([^']|\\')+'
>>
>> That way the empty character literal wouldn't be allowed and it still
>> allows all of the cases we care about.
>
> You could, but the same reasoning applies here:  An error message
> saying "empty character literal" is almost certainly more useful than
> "syntax error, Unexpected '" or whatever bison will give us on its
> own.

Good point, will do.

Thanks,
     Anton

> --
> David Gibson                    | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
>                                | _way_ _around_!
> http://www.ozlabs.org/~dgibson
>


More information about the devicetree-discuss mailing list