diff --git a/src/asm/asmy.y b/src/asm/asmy.y index 3257b8d1..bf7c0d74 100644 --- a/src/asm/asmy.y +++ b/src/asm/asmy.y @@ -354,20 +354,14 @@ static void if_skip_to_else(void) src++; } } else { - switch (*src) { - case '\\': - src += 2; - break; - - case '\"': - src += 2; + if (*src == '\"') { inString = false; - break; - - default: - src++; - break; + } else if (*src == '\\') { + /* Escaped quotes don't end the string */ + if (*++src != '\"') + src--; } + src++; } } @@ -405,21 +399,14 @@ static void if_skip_to_endc(void) src++; } } else { - switch (*src) { - - case '\\': - src += 2; - break; - - case '\"': - src++; + if (*src == '\"') { inString = false; - break; - - default: - src++; - break; + } else if (*src == '\\') { + /* Escaped quotes don't end the string */ + if (*++src != '\"') + src--; } + src++; } } diff --git a/test/asm/correct-line-number.asm b/test/asm/correct-line-number.asm new file mode 100644 index 00000000..9c672a51 --- /dev/null +++ b/test/asm/correct-line-number.asm @@ -0,0 +1,11 @@ +IF 0 + "\ + " +ELIF 1 + WARN "Am I geting ahead of myself?" +ELSE + "\ + " +ENDC + +WARN "Hopefully not." \ No newline at end of file diff --git a/test/asm/correct-line-number.out b/test/asm/correct-line-number.out new file mode 100644 index 00000000..34e07cae --- /dev/null +++ b/test/asm/correct-line-number.out @@ -0,0 +1,4 @@ +warning: correct-line-number.asm(5): + Am I geting ahead of myself? +warning: correct-line-number.asm(11): + Hopefully not. diff --git a/test/asm/correct-line-number.out.pipe b/test/asm/correct-line-number.out.pipe new file mode 100644 index 00000000..4c172022 --- /dev/null +++ b/test/asm/correct-line-number.out.pipe @@ -0,0 +1,4 @@ +warning: -(5): + Am I geting ahead of myself? +warning: -(11): + Hopefully not. diff --git a/test/asm/multiple-charmaps.out b/test/asm/multiple-charmaps.out index 4be67109..5cf76894 100644 --- a/test/asm/multiple-charmaps.out +++ b/test/asm/multiple-charmaps.out @@ -1,6 +1,6 @@ warning: multiple-charmaps.asm(75): Using 'charmap' within a section when the current charmap is 'main' is deprecated -ERROR: multiple-charmaps.asm(100) -> new_(5): +ERROR: multiple-charmaps.asm(100) -> new_(6): Charmap 'map1' already exists ERROR: multiple-charmaps.asm(102) -> set_(2): Charmap 'map5' doesn't exist diff --git a/test/asm/multiple-charmaps.out.pipe b/test/asm/multiple-charmaps.out.pipe index 7d6126a7..78278aa2 100644 --- a/test/asm/multiple-charmaps.out.pipe +++ b/test/asm/multiple-charmaps.out.pipe @@ -1,6 +1,6 @@ warning: -(75): Using 'charmap' within a section when the current charmap is 'main' is deprecated -ERROR: -(100) -> new_(5): +ERROR: -(100) -> new_(6): Charmap 'map1' already exists ERROR: -(102) -> set_(2): Charmap 'map5' doesn't exist