about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-04-16 16:49:38 -0700
committerKartik Agaram <vc@akkartik.com>2019-04-16 16:49:38 -0700
commitcb2344a2655e3097394a91168a5f046956d23cb8 (patch)
tree7ee656feeba54aa0443abbb3ff67947f3b338afe /subx
parent2f581f1b07b3b9be655238f07e2f71eb0a0d8f30 (diff)
downloadmu-cb2344a2655e3097394a91168a5f046956d23cb8.tar.gz
5093
Bugfix in string escapes.
Diffstat (limited to 'subx')
-rw-r--r--subx/038---literal_strings.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/subx/038---literal_strings.cc b/subx/038---literal_strings.cc
index 407470ff..72534697 100644
--- a/subx/038---literal_strings.cc
+++ b/subx/038---literal_strings.cc
@@ -77,11 +77,11 @@ void add_global_to_data_segment(const string& name, const word& value, segment&
 
 void test_instruction_with_string_literal() {
   parse_instruction_character_by_character(
-      "a \"abc  def\\nwee\" z\n"  // two spaces inside string
+      "a \"abc  \\\"def\\nwee\" z\n"  // two spaces inside string
   );
   CHECK_TRACE_CONTENTS(
       "parse2: word: a\n"
-      "parse2: word: \"abc  def\\nwee\"\n"
+      "parse2: word: \"abc  \"def\\nwee\"\n"
       "parse2: word: z\n"
   );
   // no other words
@@ -126,12 +126,12 @@ void parse_instruction_character_by_character(const string& line_data, vector<li
         if (c == '\\') {
           in >> c;
           if (c == 'n') d << '\n';
-          else if (c == 't') d << '\t';
           else if (c == '"') d << '"';
           else {
             raise << "parse_instruction_character_by_character: unknown escape sequence '\\" << c << "'\n" << end();
             return;
           }
+          continue;
         } else {
           d << c;
         }