]> granicus.if.org Git - onig/commitdiff
output string-ambig in print_indent_tree()
authorK.Kosako <kosako@sofnec.co.jp>
Fri, 28 Sep 2018 05:59:57 +0000 (14:59 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Fri, 28 Sep 2018 05:59:57 +0000 (14:59 +0900)
src/regcomp.c

index dd2bfa7ae76bf977c44bc7b39726802b2cd5ece9..4ad77f24e6f29146fe7f1135509d390ae1e374eb 100644 (file)
@@ -6505,12 +6505,23 @@ print_indent_tree(FILE* f, Node* node, int indent)
     break;
 
   case NODE_STRING:
-    fprintf(f, "<string%s:%p>", (NODE_STRING_IS_RAW(node) ? "-raw" : ""), node);
-    for (p = STR_(node)->s; p < STR_(node)->end; p++) {
-      if (*p >= 0x20 && *p < 0x7f)
-        fputc(*p, f);
-      else {
-        fprintf(f, " 0x%02x", *p);
+    {
+      char* mode;
+
+      if (NODE_STRING_IS_RAW(node))
+        mode = "-raw";
+      else if (NODE_STRING_IS_AMBIG(node))
+        mode = "-ambig";
+      else
+        mode = "";
+
+      fprintf(f, "<string%s:%p>", mode, node);
+      for (p = STR_(node)->s; p < STR_(node)->end; p++) {
+        if (*p >= 0x20 && *p < 0x7f)
+          fputc(*p, f);
+        else {
+          fprintf(f, " 0x%02x", *p);
+        }
       }
     }
     break;