From: Ulya Trofimovich Date: Wed, 15 Apr 2015 14:09:45 +0000 (+0100) Subject: Continued adding "--skeleton" switch. X-Git-Tag: 0.15~304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=978e38e154e907407484cc9ba64ee62185794057;p=re2c Continued adding "--skeleton" switch. Code cleanup. --- diff --git a/re2c/skeleton.cc b/re2c/skeleton.cc index bdede65f..cb711a2c 100644 --- a/re2c/skeleton.cc +++ b/re2c/skeleton.cc @@ -216,20 +216,18 @@ void generate_data (DataFile & o, uint ind, SkeletonState * s, std::vectorfirst == NULL) { - const uint r = is_accepting ? s->rule : ~0u; - s->path = new Prefix (std::vector (), 0, r); + s->path = new Prefix (std::vector (), 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]); }