summaryrefslogtreecommitdiff
path: root/util/sconfig
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2016-05-07 19:43:25 -0700
committerDuncan Laurie <dlaurie@google.com>2016-05-16 19:49:37 +0200
commitb1fb0152bfe02d5f22a9550e22b8cc522b5adbfd (patch)
treea5fad1283f604cfb1a85857fc3ee6bd2a7de2d49 /util/sconfig
parentb2aa5283e6d6f21e854fa3524e923395477a23e7 (diff)
downloadcoreboot-b1fb0152bfe02d5f22a9550e22b8cc522b5adbfd.tar.xz
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 <dlaurie@chromium.org> Reviewed-on: https://review.coreboot.org/14787 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/sconfig')
-rwxr-xr-xutil/sconfig/sconfig.l1
1 files changed, 1 insertions, 0 deletions
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);}
%%