[coreboot-gerrit] New patch to review for coreboot: sconfig: Allow strings in devicetree.cb
Duncan Laurie (dlaurie@google.com)
gerrit at coreboot.org
Thu May 12 16:17:18 CEST 2016
Duncan Laurie (dlaurie at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14787
-gerrit
commit 7ada5d78b22b80279754cbeeff3bdca9c96903ae
Author: Duncan Laurie <dlaurie at chromium.org>
Date: Sat May 7 19:43:25 2016 -0700
sconfig: Allow strings in devicetree.cb
Currently you cannot assign a string to a register in devicetree because
the quotes are removed when parsing and the literal is assigned directly.
Add a parse option for two double-quotation marks to indicate a string
and return a quoted literal that can be assigned to a register with a
'const char *' type.
Change-Id: I621cde1f7547494a8035fbbab771f29522da1687
Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
util/sconfig/sconfig.l | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l
index dad574e..40fb164 100755
--- a/util/sconfig/sconfig.l
+++ b/util/sconfig/sconfig.l
@@ -49,6 +49,7 @@ end {return(END);}
[0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
INT[A-D] {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
+\"\"[^\"]+\"\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
\"[^\"]+\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
[^ \n\t]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
%%
More information about the coreboot-gerrit
mailing list