diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-05 13:27:25 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-05 13:27:25 +0200 |
commit | 9720307ab4d78bec3fc7bc7e44cf8ba217584a17 (patch) | |
tree | df31a2da8fb34a8fadbe076684fa8d8046d0fd10 | |
parent | 7b2cfb422af6a957aa90e22bd6e9b19f16b30319 (diff) | |
download | fastd-9720307ab4d78bec3fc7bc7e44cf8ba217584a17.tar fastd-9720307ab4d78bec3fc7bc7e44cf8ba217584a17.zip |
Fix string escaping in config lexer
-rw-r--r-- | src/config.l | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/config.l b/src/config.l index 1de0457..c352a1d 100644 --- a/src/config.l +++ b/src/config.l @@ -111,10 +111,19 @@ no { UPDATE_LOCATION; return TOK_NO; } int i, esc = 0; for (i = 0; i < yyleng; i++) { - if (yytext[i] == '\\') - esc++; - else if(esc) + if (yytext[i] == '\\') { + i++; + if (yytext[i] == '\n') { + esc+=2; + } + else { + yytext[i-esc-1] = yytext[i]; + esc++; + } + } + else if(esc) { yytext[i-esc] = yytext[i]; + } } yytext[yyleng-esc-1] = 0; yylval->str = fastd_string_stack_dup(yytext); |