Fix escaping at end of gas string constant.

Patch by: Daniel Diaz <Daniel.Diaz@univ-paris1.fr>
This commit is contained in:
Peter Johnson 2011-05-29 15:29:15 -07:00
parent 3bf0ed3927
commit b96cc7d9b2
4 changed files with 10 additions and 3 deletions

View file

@ -523,8 +523,8 @@ stringconst_scan:
SCANINIT();
/*!re2c
/* Handle escaped double-quote by copying and continuing */
"\\\"" {
/* Handle escaped character by copying both and continuing. */
"\\". {
if (cursor == s->eof) {
yasm_error_set(YASM_ERROR_SYNTAX,
N_("unexpected end of file in string"));
@ -532,7 +532,8 @@ stringconst_scan:
lvalp->str.len = count;
RETURN(STRING);
}
strbuf_append(count++, cursor, s, '"');
strbuf_append(count++, cursor, s, '\\');
strbuf_append(count++, cursor, s, s->tok[1]);
goto stringconst_scan;
}

View file

@ -14,6 +14,8 @@ EXTRA_DIST += modules/parsers/gas/tests/bin/gas-macro.asm
EXTRA_DIST += modules/parsers/gas/tests/bin/gas-macro.hex
EXTRA_DIST += modules/parsers/gas/tests/bin/gas-set.asm
EXTRA_DIST += modules/parsers/gas/tests/bin/gas-set.hex
EXTRA_DIST += modules/parsers/gas/tests/bin/gas-str.asm
EXTRA_DIST += modules/parsers/gas/tests/bin/gas-str.hex
EXTRA_DIST += modules/parsers/gas/tests/bin/rept-err.asm
EXTRA_DIST += modules/parsers/gas/tests/bin/rept-err.errwarn
EXTRA_DIST += modules/parsers/gas/tests/bin/reptempty.asm

View file

@ -0,0 +1 @@
.string "a\\"

View file

@ -0,0 +1,3 @@
61
5c
00