From b1fb0152bfe02d5f22a9550e22b8cc522b5adbfd Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sat, 7 May 2016 19:43:25 -0700 Subject: 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. Example: chip drivers/i2c/generic register "hid" = ""INT343B"" register "uid" = "1" device i2c 15 on end end Change-Id: I621cde1f7547494a8035fbbab771f29522da1687 Signed-off-by: Duncan Laurie Reviewed-on: https://review.coreboot.org/14787 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- util/sconfig/sconfig.l | 1 + 1 file changed, 1 insertion(+) diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l index dad574e294..40fb164f6a 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);} %% -- cgit v1.2.3