]> granicus.if.org Git - re2c/commitdiff
'--dump-nfa': correctly print symbol ranges on NFA transitions.
authorUlya Trofimovich <skvadrik@gmail.com>
Fri, 24 Feb 2017 17:15:14 +0000 (17:15 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Fri, 24 Feb 2017 17:15:14 +0000 (17:15 +0000)
re2c/src/ir/nfa/dump.cc

index 6645afd414d8b78def9ba70f0629696e3e4644ed..c0b32ee8304fca0dcdf93b0624ba8e30ecc34c98 100644 (file)
@@ -33,12 +33,14 @@ void dump_nfa(const nfa_t &nfa)
                                fprintf(stderr, "  n%u -> n%u [color=lightgray]\n", i, index(nfa, n->alt.out2));
                                break;
                        case nfa_state_t::RAN: {
-                               const uint32_t
-                                       l = n->ran.ran->lower(),
-                                       u = n->ran.ran->upper() - 1;
-                               fprintf(stderr, "  n%u -> n%u [label=\"%u", i, index(nfa, n->ran.out), l);
-                               if (u > l) {
-                                       fprintf(stderr, "-%u", u);
+                               fprintf(stderr, "  n%u -> n%u [label=\"", i, index(nfa, n->ran.out));
+                               for (const Range *r = n->ran.ran; r; r = r->next()) {
+                                       const uint32_t
+                                               l = r->lower(),
+                                               u = r->upper() - 1;
+                                       fprintf(stderr, "%u", l);
+                                       if (u > l) fprintf(stderr, "-%u", u);
+                                       if (r->next()) fprintf(stderr, ",");
                                }
                                fprintf(stderr, "\"]\n");
                                break;