]> granicus.if.org Git - re2c/commitdiff
Fixed error in calculation of maximal path length in skeleton.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 14 Sep 2015 14:28:52 +0000 (15:28 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 14 Sep 2015 14:28:52 +0000 (15:28 +0100)
re2c/src/codegen/skeleton/maxlen.cc

index cac7a8b400963b35f9009f1492873a935e111a24..9648d7dab676dc5921ec004fc5df2cd3ed29b83a 100644 (file)
@@ -27,7 +27,14 @@ void Node::calc_dist ()
                        i->first->calc_dist ();
                        if (i->first->dist != DIST_ERROR)
                        {
-                               dist = std::max (dist, i->first->dist);
+                               if (dist == DIST_ERROR)
+                               {
+                                       dist = i->first->dist;
+                               }
+                               else
+                               {
+                                       dist = std::max (dist, i->first->dist);
+                               }
                        }
                }
                dist = std::min (dist + 1, DIST_MAX);