Thread (1 message) 1 message, 1 author, 2011-09-09

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

From: Anton Staaf <hidden>
Date: 2011-09-09 15:30:23

On Fri, Sep 9, 2011 at 12:03 AM, David Gibson
[off-list ref] wrote:
On Thu, Sep 08, 2011 at 11:40:59PM -0700, Anton Staaf wrote:
quoted
On Thu, Sep 8, 2011 at 6:12 PM, David Gibson
[off-list ref] wrote:
quoted
On Thu, Sep 08, 2011 at 02:39:16PM -0700, Anton Staaf wrote:
quoted
With this patch the following property assignment:

    property = <0x12345678 'a' '\r' 100>;

is equivalent to:

    property = <0x12345678 0x00000061 0x0000000D 0x00000064>
One tiny nit..

[snip]
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help