#ifdef RE2C_DEBUG
#include "src/util/c99_stdint.h"
+#include <map>
#include <stdio.h>
#include <string>
#include <utility>
void dump_adfa(const DFA &dfa)
{
+ std::map<const State*, uint32_t> st2idx;
+ uint32_t idx = 0;
+ for (const State *s = dfa.head; s; s = s->next) {
+ st2idx[s] = idx++;
+ }
+
fprintf(stderr,
"digraph DFA {\n"
" rankdir=LR\n"
fprintf(stderr,
" n [shape=point]"
- " n -> n%p [style=dotted label=\"", (void*)dfa.head);
+ " n -> n%u [style=dotted label=\"", st2idx[dfa.head]);
dump_tcmd(dfa.tcpool[dfa.tags0]);
fprintf(stderr, "\"]\n");
} else {
attr = "";
}
- fprintf(stderr, " n%p [height=0.2 width=0.2 label=\"", (void*)s);
+ fprintf(stderr, " n%u [height=0.2 width=0.2 label=\"", st2idx[s]);
if (s->fill && action != Action::MOVE) {
fprintf(stderr, "F(%u) ", (uint32_t)s->fill);
}
if (action == Action::ACCEPT) {
const accept_t &accept = *s->action.info.accepts;
for (uint32_t i = 0; i < accept.size(); ++i) {
- fprintf(stderr, " n%p -> n%p [label=\"",
- (void*)s, (void*)accept[i].first);
+ fprintf(stderr, " n%u -> n%u [label=\"", st2idx[s],
+ st2idx[accept[i].first]);
dump_tcmd(dfa.tcpool[accept[i].second]);
fprintf(stderr, "\" style=dotted]\n");
}
} else {
attr = "";
}
- fprintf(stderr, " n%p -> n%p [label=\"", (void*)s, (void*)x->to);
+ fprintf(stderr, " n%u -> n%u [label=\"", st2idx[s], st2idx[x->to]);
if (eat) dump_adfa_range(lb, x->ub);
dump_tcmd(dfa.tcpool[x->tags]);
fprintf(stderr, "\" %s]\n", attr);
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph DFA {
+ rankdir=LR
+ node[shape=Mrecord fontname=fixed]
+ edge[arrowhead=vee fontname=fixed]
+
+ n [shape=point] n -> n0 [style=dotted label=""]
+ n0 [height=0.2 width=0.2 label="F(1) " ]
+ n0 -> n1 [label="/1↑ 2↓ 3↓ " style=dotted]
+ n0 -> n2 [label="97/1↑ 2↑ " ]
+ n0 -> n1 [label="/1↑ 2↓ 3↓ " style=dotted]
+ n1 [height=0.2 width=0.2 label="/(1) /(0) /(2) /(3)" style=filled fillcolor=lightgray]
+ n2 [height=0.2 width=0.2 label="F(1) " ]
+ n2 -> n3 [label="" style=dotted]
+ n3 [height=0.2 width=0.2 label="" ]
+ n3 -> n1 [label="/3↑ " style=dotted]
+ n3 -> n2 [label="97/2↑ " ]
+ n3 -> n1 [label="/3↑ " style=dotted]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph CFG {
+ rankdir=LR
+ node[shape=Mrecord fontname=Terminus height=0.2 width=0.2]
+ edge[arrowhead=vee fontname=Terminus]
+
+ n0 [label="0\n/\nneed:"]
+ n0 -> n1 [style=solid]
+ n0 -> n3 [style=solid]
+ n1 [label="1\n5↑ 4↑ /\nneed: 4 5"]
+ n1 -> n2 [style=solid]
+ n1 -> n4 [style=solid]
+ n2 [label="2\n5↑ /\nneed: 4 5"]
+ n2 -> n2 [style=solid]
+ n2 -> n4 [style=solid]
+ n3 [label="3\n3↓ 2↓ 1↑ /1 2 3 \nneed: 1 2 3"]
+ n4 [label="4\n2=5 1=4 3↑ /1 2 3 \nneed: 1 2 3"]
+}
+digraph CFG {
+ rankdir=LR
+ node[shape=Mrecord fontname=Terminus height=0.2 width=0.2]
+ edge[arrowhead=vee fontname=Terminus]
+
+ n0 [label="0\n/\nneed:"]
+ n0 -> n1 [style=solid]
+ n0 -> n3 [style=solid]
+ n1 [label="1\n1↑ 2↑ /\nneed: 1 2"]
+ n1 -> n2 [style=solid]
+ n1 -> n4 [style=solid]
+ n2 [label="2\n2↑ /\nneed: 1 2"]
+ n2 -> n2 [style=solid]
+ n2 -> n4 [style=solid]
+ n3 [label="3\n1↑ 2↓ 3↓ /1 2 3 \nneed: 1 2 3"]
+ n4 [label="4\n3↑ /1 2 3 \nneed: 1 2 3"]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph DFA {
+ rankdir=LR
+ node[shape=Mrecord fontname=Courier]
+ edge[arrowhead=vee fontname=Courier]
+
+ n [shape=point] n -> n0 [style=dotted label=""]
+ n0 [height=0.2 width=0.2 label="0"]
+subgraph { rank=same n0 [style=filled fillcolor=lightgray] dr0 [shape=none label="/7↓ 6↓ 5↑ (5 0 6 7)"] n0:s -> dr0:n [style=dotted minlen=0]}
+ n0 -> n1 [label="1/9↑ 8↑ "]
+ n1 [height=0.2 width=0.2 label="1"]
+subgraph { rank=same n1 [style=filled fillcolor=lightgray] dr1 [shape=none label="/6=9 5=8 7↑ (5 0 6 7)"] n1:s -> dr1:n [style=dotted minlen=0]}
+ n1 -> n1 [label="1/9↑ "]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph DFA {
+ rankdir=LR
+ node[shape=Mrecord fontname=Courier]
+ edge[arrowhead=vee fontname=Courier]
+
+ n [shape=point] n -> n0 [style=dotted label=""]
+ n0 [height=0.2 width=0.2 label="0"]
+subgraph { rank=same n0 [style=filled fillcolor=lightgray] dr0 [shape=none label="/1↑ 2↓ 3↓ (1 0 2 3)"] n0:s -> dr0:n [style=dotted minlen=0]}
+ n0 -> n1 [label="1/1↑ 2↑ "]
+ n1 [height=0.2 width=0.2 label="1"]
+subgraph { rank=same n1 [style=filled fillcolor=lightgray] dr1 [shape=none label="/3↑ (1 0 2 3)"] n1:s -> dr1:n [style=dotted minlen=0]}
+ n1 -> n1 [label="1/2↑ "]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph DFA {
+ rankdir=LR
+ node[shape=plaintext fontname=Courier]
+ edge[arrowhead=vee fontname=Courier]
+
+ 0 [label=<<TABLE BORDER="0" CELLBORDER="1"><TR><TD ALIGN="left" PORT="0">0 1 2 3 4 /0↑ 2↓ 3↓ 1↑ </TD></TR><TR><TD ALIGN="left" PORT="1">4 1 2 3 4 /0↑ 2↑ </TD></TR></TABLE>>]
+ void [shape=point]
+ void -> 0:0:w [style=dotted label=""]
+ void -> 0:1:w [style=dotted label=""]
+ r0 [shape=none label="(5 0 6 7)"]
+ 0:0:e -> r0 [style=dotted label="/7↓ 6↓ 5↑ "]
+ 1 [label=<<TABLE BORDER="0" CELLBORDER="1"><TR><TD ALIGN="left" PORT="0">0 8 2 9 4 /3↑ 1↑ </TD></TR><TR><TD ALIGN="left" PORT="1">4 8 2 9 4 /3↑ 2↑ </TD></TR></TABLE>>]
+ 0:1:e -> 1:0:w [label="1/8 9↑ "]
+ 0:1:e -> 1:1:w [label="1/8 9↑ "]
+ r1 [shape=none label="(5 0 6 7)"]
+ 1:1:e -> r1 [style=dotted label="/6=9 5=8 7↑ "]
+ i1 [label=<<TABLE BORDER="0" CELLBORDER="1"><TR><TD ALIGN="left" PORT="0" STYLE="dotted">0 8 2 10 11 /3↑ 1↑ </TD></TR><TR><TD ALIGN="left" PORT="1" STYLE="dotted">4 8 2 10 11 /3↑ 2↑ </TD></TR></TABLE>>]
+ i1 [style=dotted]
+ i1:s -> 1:s [style=dotted label="/9↑ "]
+ 1:1:e -> i1:0:w [label="1/10↑ 11↑ "]
+ 1:1:e -> i1:1:w [label="1/10↑ 11↑ "]
+ r1 [shape=none label="(5 0 6 7)"]
+ 1:1:e -> r1 [style=dotted label="/6=9 5=8 7↑ "]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph DFA {
+ rankdir=LR
+ node[shape=Mrecord fontname=Courier]
+ edge[arrowhead=vee fontname=Courier]
+
+ n [shape=point] n -> n0 [style=dotted label=""]
+ n0 [height=0.2 width=0.2 label="0"]
+subgraph { rank=same n0 [style=filled fillcolor=lightgray] dr0 [shape=none label="/1↑ 2↓ 3↓ (1 0 2 3)"] n0:s -> dr0:n [style=dotted minlen=0]}
+ n0 -> n1 [label="1/1↑ 2↑ "]
+ n1 [height=0.2 width=0.2 label="1"]
+subgraph { rank=same n1 [style=filled fillcolor=lightgray] dr1 [shape=none label="/3↑ (1 0 2 3)"] n1:s -> dr1:n [style=dotted minlen=0]}
+ n1 -> n1 [label="1/2↑ "]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = YYCURSOR;
+ goto yy4;
+ case 'b':
+ yyt1 = yyt2 = NULL;
+ yyt3 = YYCURSOR;
+ goto yy6;
+ default: goto yy2;
+ }
+yy2:
+ ++YYCURSOR;
+ {}
+yy4:
+ ++YYCURSOR;
+ yyt3 = yyt4 = NULL;
+ yyt2 = YYCURSOR;
+yy5:
+ yynmatch = 3;
+ yypmatch[2] = yyt1;
+ yypmatch[3] = yyt2;
+ yypmatch[4] = yyt3;
+ yypmatch[5] = yyt4;
+ yypmatch[0] = YYCURSOR - 1;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy6:
+ ++YYCURSOR;
+ yyt4 = YYCURSOR;
+ goto yy5;
+}
+
+ 1 2 3 4 5 6 7 8
+ * * * * . . . .
+ * * * * . * . .
+ * * * * . * * .
+ * * * * . . . .
+ . . . . * . . .
+ . * * . . * . *
+ . . * . . . * *
+ . . . . . * * *
+ 1 2 3 4
+ * * * *
+ * * * *
+ * * * *
+ * * * *
--- /dev/null
+/*!re2c
+ ("a")|("b") {}
+ * {}
+*/
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt1 = yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt2 = yyt3 = NULL;
+ yyt1 = YYCURSOR;
+ goto yy2;
+ }
+yy2:
+ yynmatch = 2;
+ yypmatch[0] = yyt1;
+ yypmatch[2] = yyt2;
+ yypmatch[3] = yyt3;
+ yypmatch[1] = YYCURSOR;
+ {}
+yy3:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yyt2 = YYCURSOR;
+ goto yy3;
+ default:
+ yyt3 = YYCURSOR;
+ goto yy2;
+ }
+}
+
+re2c: warning: line 2: rule matches empty string [-Wmatch-empty-string]
+digraph NFA {
+ rankdir=LR
+ node[shape=Mrecord fontname=Courier height=0.2 width=0.2]
+ edge[arrowhead=vee fontname=Courier label=" "]
+
+ n9 [label="9(1)"]
+ n9 -> n8 [label="/0↑(1)"]
+ n8 [label="8(1)"]
+ n8 -> n5
+ n8 -> n7 [color=lightgray]
+ n7 [label="7(1)"]
+ n7 -> n6 [label="/2↓(2)"]
+ n6 [label="6(1)"]
+ n6 -> n1 [label="/3↓(1)"]
+ n5 [label="5(2)"]
+ n5 -> n4 [label="/2↑(2)"]
+ n4 [label="4(1)"]
+ n4 -> n3 [label="97"]
+ n3 [label="3(1)"]
+ n3 -> n2 [label="/3↑(1)"]
+ n2 [label="2(1)"]
+ n2 -> n5
+ n2 -> n1 [color=lightgray]
+ n1 [label="1(2)"]
+ n1 -> n0 [label="/1↑(0)"]
+ n0 [label="0(1)"] [fillcolor=gray]
+}
--- /dev/null
+/*!re2c
+ ("a")* {}
+*/