diff c/regexParser/determinize.cc @ 111:1d30f70702df pairPro

add determinize.cc and transition.cc
author masa
date Sat, 21 Nov 2015 18:04:25 +0900
parents
children 66c633575b53
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c/regexParser/determinize.cc	Sat Nov 21 18:04:25 2015 +0900
@@ -0,0 +1,16 @@
+#include "transition.h"
+
+TransitionPtr determinize(TransitionPtr cond, TransitionPtr list) {
+    TransitionPtr x0 = createTransition(x->condition, x->nextState);
+    TransitionPtr x1 = x0;
+    for(;;) {
+        if (x->next == NULL) {
+            x1->next = y;
+            return x0;
+        }
+        x = x->next;
+        x1->next = createTransition(x->condition, x->nextState);
+        x1 = x1->next;
+    }
+    return x0; 
+}