]> granicus.if.org Git - re2c/commitdiff
Continued adding "--skeleton" switch.
authorUlya Trofimovich <skvadrik@gmail.com>
Wed, 15 Apr 2015 14:09:45 +0000 (15:09 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Wed, 15 Apr 2015 14:09:45 +0000 (15:09 +0100)
Code cleanup.

re2c/skeleton.cc

index bdede65fce01ed0894549c78e72a926680af63ea..cb711a2cd9c66273abf3cacc18a58b5f63400569 100644 (file)
@@ -216,20 +216,18 @@ void generate_data (DataFile & o, uint ind, SkeletonState * s, std::vector<Prefi
                                {
                                        if (i->first == NULL)
                                        {
-                                               const uint r = is_accepting ? s->rule : ~0u;
-                                               s->path = new Prefix (std::vector<uint> (), 0, r);
+                                               s->path = new Prefix (std::vector<uint> (), 0, s->rule);
                                                s->path->chars.push_back (i->second[0]);
                                        }
                                        else if (i->first->path != NULL)
                                        {
-                                               const uint l = i->first->path->rule != ~0u
+                                               const bool is_accepting_path = i->first->path->rule != ~0u;
+                                               const uint l = is_accepting_path
                                                        ? i->first->path->length + 1
                                                        : 0;
-                                               const uint r = i->first->path->rule != ~0u
+                                               const uint r = is_accepting_path
                                                        ? i->first->path->rule
-                                                       : is_accepting
-                                                               ? s->rule
-                                                               : ~0u;
+                                                       : s->rule;
                                                s->path = new Prefix (i->first->path->chars, l, r);
                                                s->path->chars.push_back (i->second[0]);
                                        }