summaryrefslogtreecommitdiff
path: root/dtc-lexer.l
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2011-09-09 12:16:30 -0700
committerJon Loeliger <jdl@jdl.com>2011-09-22 09:24:31 -0500
commita4ea2fa9518ff0f4d7f4a08647599a727faac2e0 (patch)
tree1d51fe9f5d39c2beb168a20efb90cc51e6f46d52 /dtc-lexer.l
parent83df28bd39979b32a75656cac291c36dbd4e5497 (diff)
downloaddtc-a4ea2fa9518ff0f4d7f4a08647599a727faac2e0.tar.gz
dtc: Support character literals in cell lists
With this patch the following property assignment: property = <0x12345678 'a' '\r' 100>; is equivalent to: property = <0x12345678 0x00000061 0x0000000D 0x00000064> Signed-off-by: Anton Staaf <robotboy@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc-lexer.l')
-rw-r--r--dtc-lexer.l8
1 files changed, 8 insertions, 0 deletions
diff --git a/dtc-lexer.l b/dtc-lexer.l
index e866ea5..494e342 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 '([^']|\\')*'
WS [[:space:]]
COMMENT "/*"([^*]|\*+[^*/])*\*+"/"
LINECOMMENT "//".*\n
@@ -109,6 +110,13 @@ static int pop_input_file(void);
return DT_LITERAL;
}
+<*>{CHAR_LITERAL} {
+ yytext[yyleng-1] = '\0';
+ yylval.literal = xstrdup(yytext+1);
+ DPRINT("Character literal: %s\n", yylval.literal);
+ return DT_CHAR_LITERAL;
+ }
+
<*>\&{LABEL} { /* label reference */
DPRINT("Ref: %s\n", yytext+1);
yylval.labelref = xstrdup(yytext+1);