More nested data refinement.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 19:05:48 +0000 (11:05 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 19:05:48 +0000 (11:05 -0800)
dump.c

diff --git a/dump.c b/dump.c
index 55efec4b7340d807b332319553ba150e547fe278..ff06d66747c2208d80c314be66f7c493f1ca0946 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -208,14 +208,19 @@ get_string(const char *where)
 #define get_string() get_string(WHERE)
 
 static void
-dump_empty_nested(void)
+dump_nested_string(void)
 {
+  match_byte_assert (0);
+  match_byte_assert (0);
   int outer_end = pos + get_u32();
   int inner_end = pos + get_u32();
   if (pos != inner_end)
     {
       match_u32_assert(0);
-      match_byte_assert(0x58);
+      if (match_byte(0x31))
+        get_string();
+      else
+        match_byte_assert(0x58);
       if (pos != inner_end)
         {
           fprintf(stderr, "inner end discrepancy\n");
@@ -279,31 +284,7 @@ dump_value_31(void)
       else if (match_u32 (1))
         {
           printf("(footnote %d) ", get_u32());
-          match_byte_assert (0);
-          match_byte_assert (0);
-
-          int outer_end = pos + get_u32();
-          int inner_end = pos + get_u32();
-          if (pos != inner_end)
-            {
-              match_u32_assert(0);
-              if (match_byte(0x31))
-                get_string();
-              else
-                match_byte_assert(0x58);
-              if (pos != inner_end)
-                {
-                  fprintf(stderr, "inner end discrepancy\n");
-                  exit(1);
-                }
-            }
-          match_byte_assert(0x58);
-          match_byte_assert(0x58);
-          if (pos != outer_end)
-            {
-              fprintf(stderr, "outer end discrepancy\n");
-              exit(1);
-            }
+          dump_nested_string();
         }
       else if (match_u32 (2))
         {
@@ -312,9 +293,7 @@ dump_value_31(void)
           match_byte_assert(0);
           if (!match_u32 (2))
             match_u32_assert(1);
-          match_byte_assert(0);
-          match_byte_assert(0);
-          dump_empty_nested();
+          dump_nested_string(); /* Our corpus doesn't contain any examples with strings though. */
         }
       else
         {
@@ -325,9 +304,7 @@ dump_value_31(void)
           match_byte_assert(1);
           match_byte_assert(0);
           match_u32_assert(2);
-          match_byte_assert(0);
-          match_byte_assert(0);
-          dump_empty_nested();
+          dump_nested_string(); /* Our corpus doesn't contain any examples with strings though. */
         }
     }
   else