From: borutr Date: Sat, 20 Jan 2007 19:40:45 +0000 (+0000) Subject: fixed bug in stringLiteral() X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=c03aeb7c6e0f49d55a275fa3cfc63a380d6c57cf;p=fw%2Fsdcc fixed bug in stringLiteral() git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4588 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index f4c69a87..dd28b35e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-01-20 Borut Razem + + * src/SDCC.lex, src/SDCCmain.c, sdc/SDCCglobl.h, doc/sdccman.lyx: + implemented RFE #1470316: allow "$" in variable names + 2007-01-20 Raphael Neider * device/include/pic/pic14regs.h: reverted accidental wipe of the file diff --git a/src/SDCC.lex b/src/SDCC.lex index 06033d83..7fbe4e7f 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -444,11 +444,10 @@ static const char *stringLiteral(void) dbuf_append_char(&dbuf, '"'); /* Pass end of this string or substring to evaluator */ while ((ch = input()) && (isspace(ch) || ch == '\\' || ch == '#')) { - count_char(ch); - switch (ch) { case '\\': + count_char(ch); if ((ch = input()) != '\n') { werror(W_STRAY_BACKSLASH, column); @@ -457,9 +456,9 @@ static const char *stringLiteral(void) else count_char(ch); } - else - count_char(ch); - break; + else + count_char(ch); + break; case '\n': count_char(ch); @@ -472,6 +471,8 @@ static const char *stringLiteral(void) struct dbuf_s linebuf; const char *line; + count_char(ch); + dbuf_init(&linebuf, STR_BUF_CHUNCK_LEN); dbuf_append_char(&linebuf, '#'); @@ -491,6 +492,13 @@ static const char *stringLiteral(void) dbuf_destroy(&linebuf); } + else + unput(ch); + break; + + default: + count_char(ch); + break; } }