From 3b27f67096806cd6699f7f533979cd999909b369 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Thu, 9 Aug 2018 21:45:38 +0100 Subject: [PATCH] Replaced Kuklewicz POSIX disambiguation algorithm with Okui algorithm. Changes in the test results are caused by putting negative tags of the right alternative *before* the alternative. --- re2c/src/dfa/closure.cc | 176 ++++----------- re2c/src/dfa/closure.h | 8 +- re2c/src/dfa/determinization.cc | 24 +- re2c/src/dfa/dump.cc | 44 ++-- re2c/src/dfa/dump.h | 1 + re2c/src/dfa/find_state.cc | 93 ++++---- re2c/src/dfa/find_state.h | 12 +- re2c/src/dfa/tagpool.cc | 6 +- re2c/src/dfa/tagpool.h | 6 +- re2c/src/dfa/tagtree.cc | 208 +++++++++--------- re2c/src/dfa/tagtree.h | 16 +- re2c/src/re/ast_to_re.cc | 70 +++--- re2c/src/re/default_tags.cc | 6 +- re2c/src/re/tag.cc | 19 +- re2c/src/re/tag.h | 22 +- .../posix_captures/basic/10.i--flex-syntax.c | 5 +- .../posix_captures/basic/12.i--flex-syntax.c | 7 +- .../posix_captures/basic/13.i--flex-syntax.c | 7 +- .../posix_captures/basic/15.i--flex-syntax.c | 11 +- .../posix_captures/basic/19.i--flex-syntax.c | 34 ++- .../posix_captures/basic/20.i--flex-syntax.c | 90 ++++---- .../leftmost2.i--posix-captures.c | 6 +- .../nullsubexpr/11.i--flex-syntax.c | 4 +- .../osxbsdcritical/01.i--flex-syntax.c | 11 +- .../osxbsdcritical/02.i--flex-syntax.c | 11 +- .../osxbsdcritical/03.i--flex-syntax.c | 35 ++- .../posix_captures/other/08.i--flex-syntax.c | 12 +- .../posix_captures/other/11.i--flex-syntax.c | 9 +- .../repetition/01.i--flex-syntax.c | 5 +- .../repetition/02.i--flex-syntax.c | 10 +- .../repetition/03.i--flex-syntax.c | 49 +++-- .../repetition/04.i--flex-syntax.c | 5 +- .../repetition/05.i--flex-syntax.c | 7 +- .../repetition/06.i--flex-syntax.c | 9 +- .../repetition/07.i--flex-syntax.c | 8 +- .../repetition/08.i--flex-syntax.c | 5 +- .../repetition/09.i--flex-syntax.c | 10 +- .../repetition/10.i--flex-syntax.c | 49 +++-- .../repetition/11.i--flex-syntax.c | 5 +- .../repetition/12.i--flex-syntax.c | 7 +- .../repetition/13.i--flex-syntax.c | 9 +- .../repetition/14.i--flex-syntax.c | 8 +- .../repetition/15.i--flex-syntax.c | 5 +- .../repetition/16.i--flex-syntax.c | 10 +- .../repetition/17.i--flex-syntax.c | 49 +++-- .../repetition/18.i--flex-syntax.c | 5 +- .../repetition/19.i--flex-syntax.c | 7 +- .../repetition/20.i--flex-syntax.c | 9 +- .../repetition/21.i--flex-syntax.c | 8 +- .../repetition/22.i--flex-syntax.c | 5 +- .../repetition/23.i--flex-syntax.c | 10 +- .../repetition/24.i--flex-syntax.c | 49 +++-- .../repetition/25.i--flex-syntax.c | 5 +- .../repetition/26.i--flex-syntax.c | 7 +- .../repetition/27.i--flex-syntax.c | 9 +- .../repetition/28.i--flex-syntax.c | 8 +- .../repetition/29.i--flex-syntax.c | 5 +- .../repetition/30.i--flex-syntax.c | 10 +- .../repetition/31.i--flex-syntax.c | 49 +++-- .../repetition/32.i--flex-syntax.c | 5 +- .../repetition/33.i--flex-syntax.c | 7 +- .../repetition/34.i--flex-syntax.c | 9 +- .../repetition/35.i--flex-syntax.c | 8 +- .../repetition/36.i--flex-syntax.c | 5 +- .../repetition/37.i--flex-syntax.c | 10 +- .../repetition/38.i--flex-syntax.c | 49 +++-- .../repetition/39.i--flex-syntax.c | 5 +- .../repetition/40.i--flex-syntax.c | 7 +- .../repetition/41.i--flex-syntax.c | 9 +- .../repetition/42.i--flex-syntax.c | 8 +- .../repetition/43.i--flex-syntax.c | 5 +- .../repetition/44.i--flex-syntax.c | 10 +- .../repetition/45.i--flex-syntax.c | 49 +++-- .../repetition/46.i--flex-syntax.c | 5 +- .../repetition/47.i--flex-syntax.c | 7 +- .../repetition/48.i--flex-syntax.c | 9 +- .../repetition/49.i--flex-syntax.c | 8 +- 77 files changed, 779 insertions(+), 825 deletions(-) diff --git a/re2c/src/dfa/closure.cc b/re2c/src/dfa/closure.cc index df498f73..f408ba33 100644 --- a/re2c/src/dfa/closure.cc +++ b/re2c/src/dfa/closure.cc @@ -19,24 +19,25 @@ namespace re2c { -static void closure_posix(const closure_t &init, closure_t &done, closure_t *shadow, Tagpool &tagpool, const std::vector &tags); +static void closure_posix(const closure_t &init, closure_t &done, closure_t *shadow, Tagpool &tagpool, const std::vector &tags, const prectable_t *prectbl, size_t noldclos); static void closure_leftmost(const closure_t &init, closure_t &done, closure_t *shadow, Tagpool &tagpool); -static int32_t compare_posix(const clos_t &c1, const clos_t &c2, Tagpool &tagpool, const std::vector &tags); static void prune(closure_t &clos, std::valarray &rules); static void lower_lookahead_to_transition(closure_t &clos); static tcmd_t *generate_versions(dfa_t &dfa, closure_t &clos, Tagpool &tagpool, newvers_t &newvers); -static void orders(closure_t &clos, Tagpool &tagpool, const std::vector &tags); +static void orders(closure_t &clos, Tagpool &tagpool, const std::vector &tags, + const prectable_t *prectbl_old, prectable_t *&prectbl_new, size_t noldclos); static bool cmpby_rule_state(const clos_t &x, const clos_t &y); tcmd_t *closure(dfa_t &dfa, closure_t &clos1, closure_t &clos2, - Tagpool &tagpool, newvers_t &newvers, closure_t *shadow) + Tagpool &tagpool, newvers_t &newvers, closure_t *shadow, + const prectable_t *prectbl_old, prectable_t *&prectbl_new, size_t noldclos) { // build tagged epsilon-closure of the given set of NFA states if (tagpool.opts->posix_captures) { - closure_posix(clos1, clos2, shadow, tagpool, dfa.tags); + closure_posix(clos1, clos2, shadow, tagpool, dfa.tags, prectbl_old, noldclos); prune(clos2, dfa.rules); - orders(clos2, tagpool, dfa.tags); std::sort(clos2.begin(), clos2.end(), cmpby_rule_state); + orders(clos2, tagpool, dfa.tags, prectbl_old, prectbl_new, noldclos); } else { closure_leftmost(clos1, clos2, shadow, tagpool); prune(clos2, dfa.rules); @@ -67,18 +68,6 @@ bool cmpby_rule_state(const clos_t &x, const clos_t &y) return false; } -// Skip non-orbit start tags: their position is fixed on some higher-priority -// tag (except the very first tag, but in RE2C match is always anchored). -// We cannot skip orbit start tag because the corresponding orbit end tag is -// hoisted out of loop (by construction) and is, in fact, non-orbit; but we can -// skip orbit end tag instead. -// Skipping non-orbit start tags allows us to compare all subhistories in the -// same way (incrementally). Subhistories of non-orbit start tags cannot be -// compared incrementally, because default value may be added on a later step -// than non-default value. -static bool redundant(size_t t, const std::vector &tags) { - return (t % 2 == 0) != orbit(tags[t]); -} /* note [epsilon-closures in tagged NFA] * @@ -98,7 +87,8 @@ static bool redundant(size_t t, const std::vector &tags) { */ static nfa_state_t *relax(clos_t x, closure_t &done, - closure_t *shadow, Tagpool &tagpool, const std::vector &tags) + closure_t *shadow, Tagpool &tagpool, const std::vector &tags, + const prectable_t *prectbl, size_t noldclos) { nfa_state_t *q = x.state; uint32_t &i = q->clos; @@ -120,17 +110,19 @@ static nfa_state_t *relax(clos_t x, closure_t &done, // join point; compare the new path and the old path else { clos_t &y = done[i]; - const int32_t cmp = compare_posix(x, y, tagpool, tags); - if (cmp < 0) std::swap(x, y); - if (shadow && cmp != 0) shadow->push_back(x); - if (cmp >= 0) q = NULL; + int h1, h2, l; + l = tagpool.history.precedence (x, y, h1, h2, prectbl, tags, noldclos); + if (l < 0) std::swap(x, y); + if (shadow && l != 0) shadow->push_back(x); + if (l >= 0) q = NULL; } return q; } static nfa_state_t *explore(nfa_state_t *q, closure_t &done, - closure_t *shadow, Tagpool &tagpool, const std::vector &tags) + closure_t *shadow, Tagpool &tagpool, const std::vector &tags, + const prectable_t *prectbl, size_t noldclos) { // find the next admissible transition, adjust the index // of the next transition and return the to-state @@ -140,19 +132,19 @@ static nfa_state_t *explore(nfa_state_t *q, closure_t &done, case nfa_state_t::NIL: if (q->arcidx == 0) { x.state = q->nil.out; - p = relax(x, done, shadow, tagpool, tags); + p = relax(x, done, shadow, tagpool, tags, prectbl, noldclos); ++q->arcidx; } break; case nfa_state_t::ALT: if (q->arcidx == 0) { x.state = q->alt.out1; - p = relax(x, done, shadow, tagpool, tags); + p = relax(x, done, shadow, tagpool, tags, prectbl, noldclos); ++q->arcidx; } if (q->arcidx == 1 && !p) { x.state = q->alt.out2; - p = relax(x, done, shadow, tagpool, tags); + p = relax(x, done, shadow, tagpool, tags, prectbl, noldclos); ++q->arcidx; } break; @@ -160,7 +152,7 @@ static nfa_state_t *explore(nfa_state_t *q, closure_t &done, if (q->arcidx == 0) { x.state = q->tag.out; x.tlook = tagpool.history.push(x.tlook, q->tag.info); - p = relax(x, done, shadow, tagpool, tags); + p = relax(x, done, shadow, tagpool, tags, prectbl, noldclos); ++q->arcidx; } break; @@ -172,7 +164,8 @@ static nfa_state_t *explore(nfa_state_t *q, closure_t &done, } void closure_posix(const closure_t &init, closure_t &done, - closure_t *shadow, Tagpool &tagpool, const std::vector &tags) + closure_t *shadow, Tagpool &tagpool, const std::vector &tags, + const prectable_t *prectbl, size_t noldclos) { std::stack &topsort = tagpool.astack, @@ -184,7 +177,7 @@ void closure_posix(const closure_t &init, closure_t &done, // enqueue all initial states (there might be duplicates) for (cclositer_t c = init.begin(); c != init.end(); ++c) { - q = relax(*c, done, shadow, tagpool, tags); + q = relax(*c, done, shadow, tagpool, tags, prectbl, noldclos); if (q) { topsort.push(q); q->status = GOR_TOPSORT; @@ -209,7 +202,7 @@ void closure_posix(const closure_t &init, closure_t &done, q->status = GOR_TOPSORT; // find next admissible transition - while ((p = explore(q, done, shadow, tagpool, tags)) + while ((p = explore(q, done, shadow, tagpool, tags, prectbl, noldclos)) && p->status != GOR_NOPASS) { p->active = 1; } @@ -237,7 +230,7 @@ void closure_posix(const closure_t &init, closure_t &done, if (q->active) { // scan admissible transitions q->arcidx = 0; - while ((p = explore(q, done, shadow, tagpool, tags))) { + while ((p = explore(q, done, shadow, tagpool, tags, prectbl, noldclos))) { if (p->status == GOR_NOPASS) { topsort.push(p); p->arcidx = 0; @@ -280,25 +273,6 @@ void closure_posix(const closure_t &init, closure_t &done, * with the highest priority (see note [closure items are sorted by rule]). */ -int32_t compare_posix(const clos_t &c1, const clos_t &c2, - Tagpool &tagpool, const std::vector &tags) -{ - if (tagpool.ntags == 0 - || (c1.order == c2.order && c1.tlook == c2.tlook)) return 0; - - tagtree_t &h = tagpool.history; - for (size_t t = 0; t < tagpool.ntags; ++t) { - if (redundant(t, tags)) continue; - const hidx_t i1 = c1.tlook, i2 = c2.tlook; - const tagver_t - o1 = tagpool[c1.order][t], - o2 = tagpool[c2.order][t]; - const int32_t cmp = h.compare_histories(i1, i2, o1, o2, t); - if (cmp != 0) return cmp; - } - return 0; -} - void closure_leftmost(const closure_t &init, closure_t &done, closure_t *shadow, Tagpool &tagpool) { @@ -486,94 +460,26 @@ tcmd_t *generate_versions(dfa_t &dfa, closure_t &clos, Tagpool &tagpool, newvers return cmd; } -/* note [POSIX orbit tags] - * - * POSIX disambiguation rules demand that earlier subexpressions match - * the longest possible prefix of the input string (without violating the - * whole match). To accommodate these rules, we resolve conflicts on orbit - * tags by comparison of tag subhistories on conflicting NFA paths. - * - * If one subhistory is a proper prefix of another subhistory, it is less; - * otherwise for the first pair of different offsets, if one offset is greater - * than the other, then the corresponding subhistory is less. - * - * It is possible to pre-compare two NFA paths corresponding to the same - * input string prefix and ending in the same NFA state; if paths are not - * equal, the result of this comparison will hold for any common suffix. - * - * It is also possible to pre-compare NFA paths that correspond to the same - * input prefix, but end in different NFA states. Such comparison is incorrect - * unless subhistories start at the same offset; but if it is incorrect, we - * will never use its result (tags with higher priority will also disagree). - * - * Therefore instead of keeping the whole history of offsets we calculate - * the relative order of any pair of subhistories on each step. - * - * This part of the algorithm was invented by Christopher Kuklewicz. - */ - -struct cmp_posix_t +static inline int32_t pack(int32_t longest, int32_t leftmost) { - Tagpool &tagpool; - size_t tag; - bool operator()(cclositer_t x, cclositer_t y) - { - const hidx_t i1 = x->tlook, i2 = y->tlook; - const tagver_t - o1 = tagpool[x->order][tag], - o2 = tagpool[y->order][tag]; - // comparison result is inverted, because orders are used as offsets - return tagpool.history.compare_last_subhistories(i1, i2, o1, o2, tag) > 0; - } -}; + // leftmost: higher 2 bits, longest: lower 30 bits + return longest | (leftmost << 30); +} -void orders(closure_t &clos, Tagpool &tagpool, const std::vector &tags) +void orders(closure_t &clos, Tagpool &tagpool, const std::vector &tags, + const prectable_t *prectbl_old, prectable_t *&prectbl_new, size_t noldclos) { - clositer_t b = clos.begin(), e = clos.end(), c; - const size_t - ntag = tagpool.ntags, - nclos = clos.size(); - size_t &maxclos = tagpool.maxclos; - tagver_t *&os = tagpool.orders, *o, *os0; - cclositer_t *&ps = tagpool.closes, *pe, *p; - - if (ntag == 0) return; - - // reallocate buffers if necessary - if (maxclos < nclos) { - maxclos = nclos * 2; // in advance - delete[] os; - delete[] ps; - os = new tagver_t[(ntag + 1) * maxclos]; - ps = new cclositer_t[maxclos]; - } - - os0 = os + ntag * maxclos; - pe = ps; - for (c = b; c != e; ++c) *pe++ = c; - - memset(os, 0, ntag * nclos * sizeof(tagver_t)); //some tags are skipped - for (size_t t = 0; t < ntag; ++t) { - if (redundant(t, tags)) continue; - - cmp_posix_t cmp = {tagpool, t}; - std::sort(ps, pe, cmp); - tagver_t m = 0; - o = os0; - for (p = ps; p < pe; ++m) { - *o++ = m; - for (; ++p < pe && !cmp(p[-1], p[0]);) *o++ = m; - } - - o = os; - for (c = b; c != e; ++c, o += ntag) { - o[t] = os0[std::find(ps, pe, c) - ps]; + const size_t nclos = clos.size(); + prectbl_new = tagpool.alc.alloct(nclos * nclos); + + for (size_t i = 0; i < nclos; ++i) { + for (size_t j = i + 1; j < nclos; ++j) { + int32_t rho1, rho2, l; + l = tagpool.history.precedence (clos[i], clos[j], rho1, rho2, prectbl_old, tags, noldclos); + prectbl_new[i * nclos + j] = pack(rho1, l); + prectbl_new[j * nclos + i] = pack(rho2, -l); } - } - - o = os; - for (c = b; c != e; ++c, o += ntag) { - c->order = tagpool.insert(o); + prectbl_new[i * nclos + i] = 0; } } diff --git a/re2c/src/dfa/closure.h b/re2c/src/dfa/closure.h index ed30ca35..914a867b 100644 --- a/re2c/src/dfa/closure.h +++ b/re2c/src/dfa/closure.h @@ -19,12 +19,11 @@ struct tcmd_t; struct clos_t { - nfa_state_t *origin; // for debug only nfa_state_t *state; - size_t order; // vector of orders size_t tvers; // vector of tag versions (including lookahead tags) hidx_t ttran; // history of transition tags hidx_t tlook; // history of lookahead tags + uint32_t origin; static inline bool fin(const clos_t &c) { return c.state->type == nfa_state_t::FIN; } static inline bool ran(const clos_t &c) { return c.state->type == nfa_state_t::RAN; } @@ -54,14 +53,15 @@ struct newver_cmp_t if (x.base < y.base) return true; if (x.base > y.base) return false; - return history.compare_plain(x.history, y.history, x.tag) < 0; + return history.compare_reversed(x.history, y.history, x.tag) < 0; } }; typedef std::map newvers_t; tcmd_t *closure(dfa_t &dfa, closure_t &clos1, closure_t &clos2, - Tagpool &tagpool, newvers_t &newvers, closure_t *shadow); + Tagpool &tagpool, newvers_t &newvers, closure_t *shadow, + const prectable_t *prectbl_old, prectable_t *&prectbl_new, size_t noldclos); } // namespace re2c diff --git a/re2c/src/dfa/determinization.cc b/re2c/src/dfa/determinization.cc index f2f8347a..93263d82 100644 --- a/re2c/src/dfa/determinization.cc +++ b/re2c/src/dfa/determinization.cc @@ -49,12 +49,10 @@ nfa_state_t *transition(nfa_state_t *state, uint32_t symbol) void reach(const kernel_t *kernel, closure_t &clos, uint32_t symbol) { clos.clear(); - for (size_t i = 0; i < kernel->size; ++i) { - nfa_state_t *s1 = kernel->state[i], - *s2 = transition(s1, symbol); - if (s2) { - clos_t c = {s1, s2, kernel->order[i], kernel->tvers[i], - kernel->tlook[i], HROOT}; + for (uint32_t i = 0; i < kernel->size; ++i) { + nfa_state_t *s = transition(kernel->state[i], symbol); + if (s) { + clos_t c = {s, kernel->tvers[i], kernel->tlook[i], HROOT, i}; clos.push_back(c); } } @@ -82,6 +80,7 @@ dfa_t::dfa_t(const nfa_t &nfa, const opt_t *opts, newvers_t newvers(newvers_cmp); tcmd_t *acts; dump_dfa_t dump(*this, tagpool, nfa); + prectable_t *prectbl = NULL; // all-zero tag configuration must have static number zero assert(ZERO_TAGS == tagpool.insert_const(TAGVER_ZERO)); @@ -109,17 +108,18 @@ dfa_t::dfa_t(const nfa_t &nfa, const opt_t *opts, // build tagged epsilon-closure of all reachable NFA states, // then find identical or mappable DFA state or add a new one - clos_t c0 = {NULL, nfa.root, ZERO_TAGS, INITIAL_TAGS, HROOT, HROOT}; + clos_t c0 = {nfa.root, INITIAL_TAGS, HROOT, HROOT, 0}; clos1.push_back(c0); - acts = closure(*this, clos1, clos2, tagpool, newvers, dump.shadow); - find_state(*this, dfa_t::NIL, 0/* any */, kernels, clos2, acts, dump); + acts = closure(*this, clos1, clos2, tagpool, newvers, dump.shadow, NULL, prectbl, 0); + find_state(*this, dfa_t::NIL, 0/* any */, kernels, clos2, acts, dump, prectbl); for (size_t i = 0; i < kernels.size(); ++i) { newvers.clear(); for (size_t c = 0; c < nchars; ++c) { - reach(kernels[i], clos1, charset[c]); - acts = closure(*this, clos1, clos2, tagpool, newvers, dump.shadow); - find_state(*this, i, c, kernels, clos2, acts, dump); + const kernel_t *kernel = kernels[i]; + reach(kernel, clos1, charset[c]); + acts = closure(*this, clos1, clos2, tagpool, newvers, dump.shadow, kernel->prectbl, prectbl, kernel->size); + find_state(*this, i, c, kernels, clos2, acts, dump, prectbl); } } diff --git a/re2c/src/dfa/dump.cc b/re2c/src/dfa/dump.cc index 7f8d505e..646097b6 100644 --- a/re2c/src/dfa/dump.cc +++ b/re2c/src/dfa/dump.cc @@ -7,6 +7,7 @@ #include "src/conf/opt.h" #include "src/dfa/dfa.h" #include "src/dfa/dump.h" +#include "src/dfa/find_state.h" #include "src/dfa/tagpool.h" #include "src/dfa/tagtree.h" #include "src/dfa/tcmd.h" @@ -78,14 +79,10 @@ void dump_dfa_t::closure_tags(cclositer_t c) const hidx_t l = c->tlook; const tagver_t *vers = tagpool[c->tvers]; -// const tagver_t *ords = tagpool[c->order]; const size_t ntag = tagpool.ntags; for (size_t t = 0; t < ntag; ++t) { fprintf(stderr, " %s%d", tagname(dfa.tags[t]), abs(vers[t])); -// if (tagpool.opts->posix_captures) { -// fprintf(stderr, "[%d]", ords[t]); -// } } if (l != HROOT) { @@ -102,24 +99,27 @@ void dump_dfa_t::closure(const closure_t &clos, uint32_t state, bool isnew) const char *style = isnew ? "" : " STYLE=\"dotted\"", *color = " COLOR=\"lightgray\""; + uint32_t i; fprintf(stderr, " %s%u [label=<", isnew ? "" : "i", state); - for (s = s1; s != s2; ++s) { - fprintf(stderr, "%u", - index(s->state), (int)(s - s1), color, style, color, index(s->state)); + i = 0; + for (s = s1; s != s2; ++s, ++i) { + fprintf(stderr, "%u", + i, i, color, style, color, index(s->state)); closure_tags(s); fprintf(stderr, ""); } if (!shadow->empty()) { fprintf(stderr, ""); } - for (c = c1; c != c2; ++c) { + i = 0; + for (c = c1; c != c2; ++c, ++i) { fprintf(stderr, "%u", - index(c->state), style, index(c->state)); + i, style, index(c->state)); closure_tags(c); fprintf(stderr, ""); } @@ -130,16 +130,19 @@ void dump_dfa_t::state0(const closure_t &clos) { if (!debug) return; + uint32_t i; closure(clos, 0, true); fprintf(stderr, " void [shape=point]\n"); - for (cclositer_t c = shadow->begin(); c != shadow->end(); ++c) { - fprintf(stderr, " void -> 0:_%u_%d:w [style=dotted color=lightgray fontcolor=lightgray label=\"", - index(c->state), (int)(c - shadow->begin())); + i = 0; + for (cclositer_t c = shadow->begin(); c != shadow->end(); ++c, ++i) { + fprintf(stderr, " void -> 0:_%u_%u:w [style=dotted color=lightgray fontcolor=lightgray label=\"", + i, i); dump_tags(tagpool, c->ttran, c->tvers); fprintf(stderr, "\"]\n"); } - for (cclositer_t c = clos.begin(); c != clos.end(); ++c) { - fprintf(stderr, " void -> 0:%u:w [style=dotted label=\"", index(c->state)); + i = 0; + for (cclositer_t c = clos.begin(); c != clos.end(); ++c, ++i) { + fprintf(stderr, " void -> 0:%u:w [style=dotted label=\"", i); dump_tags(tagpool, c->ttran, c->tvers); fprintf(stderr, "\"]\n"); } @@ -161,6 +164,7 @@ void dump_dfa_t::state(const closure_t &clos, size_t state, size_t symbol, bool y = static_cast(state2), z = isnew ? y : ++uniqidx; const char *prefix = isnew ? "" : "i"; + uint32_t i; closure(clos, z, isnew); if (!isnew) { @@ -169,15 +173,17 @@ void dump_dfa_t::state(const closure_t &clos, size_t state, size_t symbol, bool dump_tcmd(cmd); fprintf(stderr, "\"]\n"); } - for (cclositer_t b = shadow->begin(), c = b; c != shadow->end(); ++c) { - fprintf(stderr, " %u:%u:e -> %s%u:_%u_%d:w [color=lightgray fontcolor=lightgray label=\"%u", - x, index(c->origin), prefix, z, index(c->state), (int)(c - b), a); + i = 0; + for (cclositer_t b = shadow->begin(), c = b; c != shadow->end(); ++c, ++i) { + fprintf(stderr, " %u:%u:e -> %s%u:_%u_%u:w [color=lightgray fontcolor=lightgray label=\"%u", + x, c->origin, prefix, z, i, i, a); dump_tags(tagpool, c->ttran, c->tvers); fprintf(stderr, "\"]\n"); } - for (cclositer_t c = clos.begin(); c != clos.end(); ++c) { + i = 0; + for (cclositer_t c = clos.begin(); c != clos.end(); ++c, ++i) { fprintf(stderr, " %u:%u:e -> %s%u:%u:w [label=\"%u", - x, index(c->origin), prefix, z, index(c->state), a); + x, c->origin, prefix, z, i, a); dump_tags(tagpool, c->ttran, c->tvers); fprintf(stderr, "\"]\n"); } diff --git a/re2c/src/dfa/dump.h b/re2c/src/dfa/dump.h index c58e2810..6a7980a4 100644 --- a/re2c/src/dfa/dump.h +++ b/re2c/src/dfa/dump.h @@ -16,6 +16,7 @@ struct dfa_t; struct nfa_state_t; struct nfa_t; struct tcmd_t; +struct kernels_t; struct dump_dfa_t { diff --git a/re2c/src/dfa/find_state.cc b/re2c/src/dfa/find_state.cc index fe044bca..12ff4661 100644 --- a/re2c/src/dfa/find_state.cc +++ b/re2c/src/dfa/find_state.cc @@ -16,31 +16,41 @@ namespace re2c { -kernel_t::kernel_t(size_t n) - : size(n) - , state(new nfa_state_t*[size]) - , tvers(new size_t[size]) - , tlook(new hidx_t[size]) - , order(new size_t[size]) -{} - -kernel_t *kernel_t::copy(const kernel_t &k) +kernel_t *kernel_t::make_init(size_t size, Tagpool &tagpool) { - const size_t n = k.size; - kernel_t *kcopy = new kernel_t(n); - memcpy(kcopy->state, k.state, n * sizeof(void*)); - memcpy(kcopy->tvers, k.tvers, n * sizeof(size_t)); - memcpy(kcopy->tlook, k.tlook, n * sizeof(hidx_t)); - memcpy(kcopy->order, k.order, n * sizeof(size_t)); + kernel_t *kcopy = tagpool.alc.alloct(1); + kcopy->size = size; + kcopy->prectbl = NULL; + kcopy->state = tagpool.alc.alloct(size); + kcopy->tvers = tagpool.alc.alloct(size); + kcopy->tlook = tagpool.alc.alloct(size); return kcopy; } -kernel_t::~kernel_t() +kernel_t *kernel_t::make_copy(const kernel_t &k, Tagpool &tagpool) { - delete[] state; - delete[] tvers; - delete[] tlook; - delete[] order; + kernel_t *kcopy = tagpool.alc.alloct(1); + + const size_t size = k.size; + kcopy->size = size; + + prectable_t *prectbl = NULL; + if (k.prectbl) { + prectbl = tagpool.alc.alloct(size * size); + memcpy(prectbl, k.prectbl, size * size * sizeof(prectable_t)); + } + kcopy->prectbl = prectbl; + + kcopy->state = tagpool.alc.alloct(size); + memcpy(kcopy->state, k.state, size * sizeof(void*)); + + kcopy->tvers = tagpool.alc.alloct(size); + memcpy(kcopy->tvers, k.tvers, size * sizeof(size_t)); + + kcopy->tlook = tagpool.alc.alloct(size); + memcpy(kcopy->tlook, k.tlook, size * sizeof(hidx_t)); + + return kcopy; } static bool equal_lookahead_tags(const kernel_t *x, const kernel_t *y, @@ -54,10 +64,10 @@ static bool equal_lookahead_tags(const kernel_t *x, const kernel_t *y, const hidx_t xl = x->tlook[i], yl = y->tlook[i]; for (size_t t = 0; t < tagpool.ntags; ++t) { if (history(tags[t])) { - // compare subhistories - if (h.compare_plain(xl, yl, t) != 0) return false; + // compare full tag sequences + if (h.compare_reversed(xl, yl, t) != 0) return false; } else { - // compare only the last tags + // compare only the last pair of tags if (h.last(xl, t) != h.last(yl, t)) return false; } } @@ -74,7 +84,7 @@ struct kernel_eq_t return x->size == y->size && memcmp(x->state, y->state, x->size * sizeof(void*)) == 0 && memcmp(x->tvers, y->tvers, x->size * sizeof(size_t)) == 0 - && memcmp(x->order, y->order, x->size * sizeof(size_t)) == 0 + && (!x->prectbl || memcmp(x->prectbl, y->prectbl, x->size * x->size * sizeof(prectable_t)) == 0) && equal_lookahead_tags(x, y, tagpool, tags); } }; @@ -122,7 +132,7 @@ bool kernels_t::operator()(const kernel_t *k1, const kernel_t *k2) // check that kernel sizes, NFA states and orders coincide const bool compatible = k1->size == k2->size && memcmp(k1->state, k2->state, k1->size * sizeof(void*)) == 0 - && memcmp(k1->order, k2->order, k1->size * sizeof(size_t)) == 0 + && (! k1->prectbl || memcmp(k1->prectbl, k2->prectbl, k1->size * k1->size * sizeof(prectable_t)) == 0) && equal_lookahead_tags(k1, k2, tagpool, tags); if (!compatible) return false; @@ -215,7 +225,7 @@ kernels_t::kernels_t(Tagpool &tagp, tcpool_t &tcp, const std::vector &ts) , tags(ts) , maxsize(0) // usually ranges from one to some twenty - , buffer(new kernel_t(maxsize)) + , buffer(kernel_t::make_init(maxsize, tagp)) , cap(0) , max(0) @@ -230,23 +240,11 @@ kernels_t::kernels_t(Tagpool &tagp, tcpool_t &tcp, const std::vector &ts) , actlhs(NULL) {} -kernels_t::~kernels_t() -{ - delete buffer; - delete[] mem; - - const size_t n = lookup.size(); - for (size_t i = 0; i < n; ++i) { - delete lookup[i]; - } -} - void kernels_t::init(tagver_t v, size_t nkern) { if (maxsize < nkern) { maxsize = nkern * 2; // in advance - delete buffer; - buffer = new kernel_t(maxsize); + buffer = kernel_t::make_init(maxsize, tagpool); } // +1 to ensure max tag version is not forgotten in loops @@ -262,8 +260,7 @@ void kernels_t::init(tagver_t v, size_t nkern) sz_actnext = n * sizeof(tcmd_t*), sz_actlhs = n * sizeof(tagver_t), sz_indeg = n * sizeof(uint32_t); - delete[] mem; - mem = new char[sz_x2y + sz_x2t + sz_actnext + sz_actlhs + sz_indeg]; + mem = tagpool.alc.alloct(sz_x2y + sz_x2t + sz_actnext + sz_actlhs + sz_indeg); // point to the center (zero index) of each buffer // indexes in range [-N .. N] must be valid, where N is capacity @@ -307,7 +304,7 @@ const kernel_t *kernels_t::operator[](size_t idx) const */ kernels_t::result_t kernels_t::insert(const closure_t &clos, - tcmd_t *acts, tagver_t maxver) + tcmd_t *acts, tagver_t maxver, const prectable_t *prectbl) { const size_t nkern = clos.size(); size_t x = dfa_t::NIL; @@ -320,18 +317,20 @@ kernels_t::result_t kernels_t::insert(const closure_t &clos, // copy closure to buffer kernel and find its normal form buffer->size = nkern; + buffer->prectbl = prectbl; for (size_t i = 0; i < nkern; ++i) { const clos_t &c = clos[i]; buffer->state[i] = c.state; buffer->tvers[i] = c.tvers; buffer->tlook[i] = c.tlook; - buffer->order[i] = c.order; } // get kernel hash uint32_t hash = static_cast(nkern); // seed hash = hash32(hash, buffer->state, nkern * sizeof(void*)); - hash = hash32(hash, buffer->order, nkern * sizeof(size_t)); + if (prectbl) { + hash = hash32(hash, buffer->prectbl, nkern * nkern * sizeof(prectable_t)); + } // try to find identical kernel kernel_eq_t eq = {tagpool, tags}; @@ -345,7 +344,7 @@ kernels_t::result_t kernels_t::insert(const closure_t &clos, if (x != index_t::NIL) return result_t(x, acts, false); // otherwise add new kernel - x = lookup.push(hash, kernel_t::copy(*buffer)); + x = lookup.push(hash, kernel_t::make_copy(*buffer, tagpool)); return result_t(x, acts, true); } @@ -382,10 +381,10 @@ static tcmd_t *finalizer(const clos_t &clos, size_t ridx, } void find_state(dfa_t &dfa, size_t state, size_t symbol, kernels_t &kernels, - const closure_t &closure, tcmd_t *acts, dump_dfa_t &dump) + const closure_t &closure, tcmd_t *acts, dump_dfa_t &dump, const prectable_t *prectbl) { const kernels_t::result_t - result = kernels.insert(closure, acts, dfa.maxtagver); + result = kernels.insert(closure, acts, dfa.maxtagver, prectbl); if (result.isnew) { // create new DFA state diff --git a/re2c/src/dfa/find_state.h b/re2c/src/dfa/find_state.h index 0f084125..f65dba92 100644 --- a/re2c/src/dfa/find_state.h +++ b/re2c/src/dfa/find_state.h @@ -25,14 +25,13 @@ struct tcmd_t; struct kernel_t { size_t size; + const prectable_t *prectbl; nfa_state_t **state; size_t *tvers; // tag versions hidx_t *tlook; // lookahead tags - size_t *order; // see note [orbit order of closure items] - explicit kernel_t(size_t n); - ~kernel_t(); - static kernel_t *copy(const kernel_t &k); + static kernel_t *make_init(size_t size, Tagpool &tagpool); + static kernel_t *make_copy(const kernel_t &k, Tagpool &tagpool); FORBID_COPY(kernel_t); }; @@ -78,17 +77,16 @@ private: public: kernels_t(Tagpool &tagp, tcpool_t &tcp, const std::vector &ts); - ~kernels_t(); void init(tagver_t v, size_t nkern); size_t size() const; const kernel_t* operator[](size_t idx) const; - result_t insert(const closure_t &clos, tcmd_t *acts, tagver_t maxver); + result_t insert(const closure_t &clos, tcmd_t *acts, tagver_t maxver, const prectable_t *prectbl); bool operator()(const kernel_t *k1, const kernel_t *k2); FORBID_COPY(kernels_t); }; void find_state(dfa_t &dfa, size_t state, size_t symbol, kernels_t &kernels, - const closure_t &closure, tcmd_t *acts, dump_dfa_t &dump); + const closure_t &closure, tcmd_t *acts, dump_dfa_t &dump, const prectable_t *prectbl); } // namespace re2c diff --git a/re2c/src/dfa/tagpool.cc b/re2c/src/dfa/tagpool.cc index b4fd90af..0cc0feac 100644 --- a/re2c/src/dfa/tagpool.cc +++ b/re2c/src/dfa/tagpool.cc @@ -25,9 +25,7 @@ Tagpool::Tagpool(const opt_t *o, size_t n) , opts(o) , ntags(n) , buffer(new tagver_t[n]) - , maxclos(0) - , orders(NULL) - , closes(NULL) + , alc() , history() , astack() , bstack() @@ -41,8 +39,6 @@ Tagpool::~Tagpool() for (size_t i = 0; i < n; ++i) { free(const_cast(lookup[i])); } - delete[] orders; - delete[] closes; } size_t Tagpool::insert_const(tagver_t ver) diff --git a/re2c/src/dfa/tagpool.h b/re2c/src/dfa/tagpool.h index f06de0af..38ac840b 100644 --- a/re2c/src/dfa/tagpool.h +++ b/re2c/src/dfa/tagpool.h @@ -9,6 +9,7 @@ #include "src/re/tag.h" #include "src/util/forbid_copy.h" #include "src/util/lookup.h" +#include "src/util/slab_allocator.h" namespace re2c { @@ -29,9 +30,8 @@ public: const size_t ntags; tagver_t *buffer; - size_t maxclos; - tagver_t *orders; - cclositer_t *closes; + typedef slab_allocator_t<> alc_t; + alc_t alc; tagtree_t history; std::stack astack; diff --git a/re2c/src/dfa/tagtree.cc b/re2c/src/dfa/tagtree.cc index caa86cb2..64c76f82 100644 --- a/re2c/src/dfa/tagtree.cc +++ b/re2c/src/dfa/tagtree.cc @@ -1,6 +1,7 @@ #include #include +#include "src/dfa/closure.h" #include "src/dfa/tagtree.h" namespace re2c @@ -10,10 +11,12 @@ static const tagver_t DELIM = TAGVER_CURSOR - 1; tagtree_t::tagtree_t(): nodes(), path1(), path2() {} -tagver_t tagtree_t::elem(hidx_t i) const { return nodes[i].info.neg ? TAGVER_BOTTOM : TAGVER_CURSOR; } - hidx_t tagtree_t::pred(hidx_t i) const { return nodes[i].pred; } +tag_info_t tagtree_t::info(hidx_t i) const { return nodes[i].info; } + +tagver_t tagtree_t::elem(hidx_t i) const { return nodes[i].info.neg ? TAGVER_BOTTOM : TAGVER_CURSOR; } + size_t tagtree_t::tag(hidx_t i) const { return nodes[i].info.idx; } hidx_t tagtree_t::push(hidx_t idx, tag_info_t info) @@ -23,137 +26,132 @@ hidx_t tagtree_t::push(hidx_t idx, tag_info_t info) return static_cast(nodes.size() - 1); } -// cut out subhistory of this tag (just skip all other tags) -static void subhistory(const tagtree_t &history, - std::vector &path, hidx_t idx, size_t tag) +tagver_t tagtree_t::last(hidx_t i, size_t t) const { - path.clear(); - for (hidx_t i = idx; i != HROOT; i = history.pred(i)) { - if (history.tag(i) == tag) { - path.push_back(history.elem(i)); - } + for (; i != HROOT; i = pred(i)) { + if (tag(i) == t) return elem(i); } + return TAGVER_ZERO; } -static int32_t compare_reversed( - const std::vector &h1, - const std::vector &h2) +int32_t tagtree_t::compare_reversed(hidx_t x, hidx_t y, size_t t) const { - std::vector::const_reverse_iterator - i1 = h1.rbegin(), e1 = h1.rend(), - i2 = h2.rbegin(), e2 = h2.rend(); - + // compare in reverse, from tail to head: direction makes + // no difference when comparing for exact coincidence for (;;) { - if (i1 == e1 && i2 == e2) break; - if (i1 == e1) return -1; - if (i2 == e2) return 1; - if (*i1 > *i2) return -1; - if (*i1 < *i2) return 1; - ++i1; ++i2; + for (; x != HROOT && tag(x) != t; x = pred(x)); + for (; y != HROOT && tag(y) != t; y = pred(y)); + if (x == HROOT && y == HROOT) return 0; + if (x == HROOT) return -1; + if (y == HROOT) return 1; + if (elem(x) > elem(y)) return -1; + if (elem(x) < elem(y)) return 1; + x = pred(x); + y = pred(y); } +} - return 0; +static void reconstruct_history(const tagtree_t &history, + std::vector &path, hidx_t idx) +{ + path.clear(); + for (; idx != HROOT; idx = history.pred(idx)) { + path.push_back(history.info(idx)); + } } -int32_t tagtree_t::compare_plain(hidx_t x, hidx_t y, size_t t) +static inline int32_t unpack_longest(int32_t value) { - subhistory(*this, path1, x, t); - subhistory(*this, path2, y, t); - return compare_reversed(path1, path2); + // lower 30 bits + return value & 0x3fffFFFF; } -static size_t boundary_tag(size_t tag) +static inline int32_t unpack_leftmost(int32_t value) { - // for start tags, return itself; for end tags, return start tag - // (start tags have even numbers, end tags have odd numbers) - return tag & ~1u; + // higher 2 bits + return value >> 30u; } -// returns all subhistories of the given tag as one list (individual -// subhistories are separated by delimiter) -static int32_t subhistory_list(const tagtree_t &history, - std::vector &path, hidx_t idx, size_t tag) +int32_t tagtree_t::precedence(const clos_t &x, const clos_t &y, + int32_t &rhox, int32_t &rhoy, const prectable_t *prectbl, + const std::vector &tags, size_t nclos) { - path.clear(); - int32_t nsub = 0; - hidx_t i = idx; + const hidx_t xl = x.tlook, yl = y.tlook; + const uint32_t xo = x.origin, yo = y.origin; - const size_t bound = boundary_tag(tag); - path.push_back(DELIM); - for (;;) { - for (; i != HROOT && history.tag(i) >= bound; i = history.pred(i)) { - if (history.tag(i) == tag) { - path.push_back(history.elem(i)); - } - } - if (i == HROOT) break; - ++nsub; - path.push_back(DELIM); - for (; i != HROOT && history.tag(i) != tag; i = history.pred(i)); + if (xl == yl && xo == yo) { + rhox = rhoy = -1; + return 0; } - return nsub; -} + reconstruct_history(*this, path1, xl); + reconstruct_history(*this, path2, yl); + std::vector::const_reverse_iterator + i1 = path1.rbegin(), e1 = path1.rend(), j1 = i1, g1, + i2 = path2.rbegin(), e2 = path2.rend(), j2 = i2, g2; + const bool fork_frame = xo == yo; -// Lookahead may consist of multiple subhistories (each containing either -// a single bottom value, or one or more cursor values (exactly one for -// non-orbit subhistories). Because of the shortest-path algorithm earlier -// subhistories do not necessarily coincide, so comparing only the last -// pair of subhistories is not enough. See note [POSIX orbit tags]. -int32_t tagtree_t::compare_histories(hidx_t x, hidx_t y, - tagver_t ox, tagver_t oy, size_t t) -{ - const int32_t - n1 = subhistory_list(*this, path1, x, t), - n2 = subhistory_list(*this, path2, y, t); - - assert(n1 == n2); - path1.push_back(ox); - path2.push_back(oy); + // find fork + if (fork_frame) { + for (; j1 != e1 && j2 != e2 && *j1 == *j2; ++j1, ++j2); + } - std::vector::const_reverse_iterator - i1 = path1.rbegin(), e1 = path1.rend(), - i2 = path2.rbegin(), e2 = path2.rend(); - for (;;) { - if (i1 == e1 && i2 == e2) return 0; - assert(i1 != e1 && i2 != e2); - const tagver_t v1 = *i1++, v2 = *i2++; - if (v1 == DELIM && v2 == DELIM) continue; - if (v1 == DELIM) return -1; - if (v2 == DELIM) return 1; - if (v1 > v2) return -1; - if (v1 < v2) return 1; + // longest precedence + if (!fork_frame) { + rhox = unpack_longest(prectbl[xo * nclos + yo]); + rhoy = unpack_longest(prectbl[yo * nclos + xo]); + } else { + rhox = rhoy = std::numeric_limits::max(); + if (j1 > i1) rhox = rhoy = tags[(j1 - 1)->idx].height; } -} + for (g1 = j1; g1 != e1; ++g1) { + rhox = std::min(rhox, tags[g1->idx].height); + } + for (g2 = j2; g2 != e2; ++g2) { + rhoy = std::min(rhoy, tags[g2->idx].height); + } + if (rhox > rhoy) return -1; + if (rhox < rhoy) return 1; -static void last_subhistory(const tagtree_t &history, std::vector &path, - hidx_t idx, tagver_t order, size_t tag) -{ - path.clear(); - hidx_t i = idx; - const size_t bound = boundary_tag(tag); - for (; i != HROOT && history.tag(i) >= bound; i = history.pred(i)) { - if (history.tag(i) == tag) { - path.push_back(history.elem(i)); - } + // leftmost precedence + if (!fork_frame) { + return unpack_leftmost(prectbl[xo * nclos + yo]); } - if (i == HROOT) path.push_back(order); -} + else { + // equal => not less + if (j1 == e1 && j2 == e2) return 0; -int32_t tagtree_t::compare_last_subhistories(hidx_t x, hidx_t y, - tagver_t ox, tagver_t oy, size_t t) -{ - last_subhistory(*this, path1, x, ox, t); - last_subhistory(*this, path2, y, oy, t); - return compare_reversed(path1, path2); -} + // shorter => less + if (j1 == e1) return -1; + if (j2 == e2) return 1; -tagver_t tagtree_t::last(hidx_t i, size_t t) const -{ - for (; i != HROOT; i = pred(i)) { - if (tag(i) == t) return elem(i); + const uint32_t idx1 = j1->idx, idx2 = j2->idx; + const bool neg1 = j1->neg, neg2 = j2->neg; + + // can't be both closing + assert(!(idx1 % 2 == 1 && idx2 % 2 == 1)); + + // closing vs opening: closing wins + if (idx1 % 2 == 1) return -1; + if (idx2 % 2 == 1) return 1; + + // can't be both negative + assert(!(neg1 && neg2)); + + // positive vs negative: positive wins + if (neg1) return 1; + if (neg2) return -1; + + // positive vs positive: smaller wins + // (this case is only possible because multiple + // top-level RE don't have proper negative tags) + if (idx1 < idx2) return -1; + if (idx1 > idx2) return 1; } - return TAGVER_ZERO; + + // unreachable + assert(false); + return 0; } } // namespace re2c diff --git a/re2c/src/dfa/tagtree.h b/re2c/src/dfa/tagtree.h index 66b0b16a..921717d2 100644 --- a/re2c/src/dfa/tagtree.h +++ b/re2c/src/dfa/tagtree.h @@ -13,6 +13,8 @@ namespace re2c { typedef uint32_t hidx_t; +typedef int32_t prectable_t; +struct clos_t; static const hidx_t HROOT = ~0u; @@ -27,18 +29,20 @@ struct tagtree_t std::vector nodes; // reconstruct paths for comparison - std::vector path1; - std::vector path2; + std::vector path1; + std::vector path2; tagtree_t(); hidx_t pred(hidx_t i) const; + tag_info_t info(hidx_t i) const; tagver_t elem(hidx_t i) const; size_t tag(hidx_t i) const; - hidx_t push(hidx_t idx, tag_info_t info); - int32_t compare_plain(hidx_t x, hidx_t y, size_t t); - int32_t compare_histories(hidx_t x, hidx_t y, tagver_t ox, tagver_t oy, size_t t); - int32_t compare_last_subhistories(hidx_t x, hidx_t y, tagver_t ox, tagver_t oy, size_t t); + hidx_t push(hidx_t i, tag_info_t info); tagver_t last(hidx_t i, size_t t) const; + int32_t compare_reversed(hidx_t x, hidx_t y, size_t t) const; + int32_t precedence(const clos_t &x, const clos_t &y, int32_t &rhox, int32_t &rhoy, + const prectable_t *prectbl, const std::vector &tags, size_t nclos); + FORBID_COPY(tagtree_t); }; diff --git a/re2c/src/re/ast_to_re.cc b/re2c/src/re/ast_to_re.cc index fd7cb937..c2738649 100644 --- a/re2c/src/re/ast_to_re.cc +++ b/re2c/src/re/ast_to_re.cc @@ -47,7 +47,7 @@ namespace re2c { */ static bool has_tags(const AST *); -static RE *ast_to_re(RESpec &, const AST *, size_t &, uint32_t); +static RE *ast_to_re(RESpec &, const AST *, size_t &, int32_t); static RE *re_schar(RE::alc_t &, uint32_t, uint32_t, uint32_t, const opt_t *); static RE *re_ichar(RE::alc_t &, uint32_t, uint32_t, uint32_t, const opt_t *); static RE *re_class(RE::alc_t &, uint32_t, uint32_t, const Range *, const opt_t *, Warn &); @@ -92,7 +92,7 @@ bool has_tags(const AST *ast) } -RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, uint32_t height) +RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) { RE::alc_t &alc = spec.alc; std::vector &tags = spec.tags; @@ -147,29 +147,25 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, uint32_t height) return re_sym(alc, Range::ran(0, opts->encoding.nCodeUnits())); case AST::ALT: { RE *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *x, *y; - - if (opts->posix_captures && has_tags(ast) - && ast->alt.ast1->type != AST::CAP) { + if (opts->posix_captures && has_tags(ast)) { // see note [POSIX subexpression hierarchy] - t1 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); - t2 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); + if (ast->cat.ast1->type != AST::CAP) { + t1 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height + 1)); + t2 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height)); + } + if (ast->cat.ast2->type != AST::CAP) { + t3 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height + 1)); + t4 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height)); + } } x = ast_to_re(spec, ast->alt.ast1, ncap, height); x = re_cat(alc, t1, re_cat(alc, x, t2)); - - if (opts->posix_captures && has_tags(ast) - && ast->alt.ast2->type != AST::CAP) { - // see note [POSIX subexpression hierarchy] - t3 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); - t4 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); - } y = ast_to_re(spec, ast->alt.ast2, ncap, height); y = re_cat(alc, t3, re_cat(alc, y, t4)); - return re_alt(alc, x, y); } case AST::DIFF: { @@ -182,31 +178,25 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, uint32_t height) } case AST::CAT: { RE *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *x, *y; - - const AST *a1 = ast->alt.ast1; - if (opts->posix_captures && has_tags(ast) - && a1->type != AST::CAP) { + if (opts->posix_captures && has_tags(ast)) { // see note [POSIX subexpression hierarchy] - t1 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); - t2 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); + if (ast->cat.ast1->type != AST::CAP) { + t1 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height + 1)); + t2 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height)); + } + if (ast->cat.ast2->type != AST::CAP) { + t3 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height + 1)); + t4 = re_tag(alc, tags.size(), false); + tags.push_back(Tag(Tag::FICTIVE, false, height)); + } } x = ast_to_re(spec, ast->cat.ast1, ncap, height); x = re_cat(alc, t1, re_cat(alc, x, t2)); - - const AST *a2 = ast->alt.ast2; - if (opts->posix_captures && has_tags(ast) - && a2->type != AST::CAP) { - // see note [POSIX subexpression hierarchy] - t3 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); - t4 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(Tag::FICTIVE, false, height)); - } y = ast_to_re(spec, ast->cat.ast2, ncap, height); y = re_cat(alc, t3, re_cat(alc, y, t4)); - return re_cat(alc, x, y); } case AST::TAG: { @@ -230,7 +220,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, uint32_t height) if (x->type == AST::REF) x = x->ref.ast; RE *t1 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(2 * ncap, false, height)); + tags.push_back(Tag(2 * ncap, false, height + 1)); RE *t2 = re_tag(alc, tags.size(), false); tags.push_back(Tag(2 * ncap + 1, false, height)); @@ -260,7 +250,7 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, uint32_t height) if (x->type == AST::REF) x = x->ref.ast; t1 = re_tag(alc, tags.size(), false); - tags.push_back(Tag(2 * ncap, m > 1, height)); + tags.push_back(Tag(2 * ncap, m > 1, height + 1)); t2 = re_tag(alc, tags.size(), false); tags.push_back(Tag(2 * ncap + 1, m > 1, height)); diff --git a/re2c/src/re/default_tags.cc b/re2c/src/re/default_tags.cc index 226e7058..26ceb7e4 100644 --- a/re2c/src/re/default_tags.cc +++ b/re2c/src/re/default_tags.cc @@ -17,7 +17,7 @@ static void insert_default_tags(RESpec &spec, RE *re, size_t *&tidx) case RE::SYM: break; case RE::ALT: { size_t *i = tidx; - RE *x = re_nil(alc), *y = re_nil(alc); + RE *x = NULL, *y = NULL; insert_default_tags(spec, re->alt.re1, tidx); for (; i < tidx; ++i) { x = re_cat(alc, x, re_tag(alc, *i, true)); @@ -27,7 +27,9 @@ static void insert_default_tags(RESpec &spec, RE *re, size_t *&tidx) y = re_cat(alc, y, re_tag(alc, *i, true)); } re->alt.re1 = re_cat(alc, re->alt.re1, y); - re->alt.re2 = re_cat(alc, re->alt.re2, x); + re->alt.re2 = spec.opts->posix_captures + ? re_cat(alc, x, re->alt.re2) + : re_cat(alc, re->alt.re2, x); break; } case RE::CAT: diff --git a/re2c/src/re/tag.cc b/re2c/src/re/tag.cc index 399bcb79..7c2b4d13 100644 --- a/re2c/src/re/tag.cc +++ b/re2c/src/re/tag.cc @@ -5,41 +5,30 @@ namespace re2c { -static uint32_t fix_height(size_t, uint32_t); - - const size_t Tag::RIGHTMOST = std::numeric_limits::max(); const size_t Tag::VARDIST = std::numeric_limits::max(); const size_t Tag::FICTIVE = Tag::RIGHTMOST - 1; -Tag::Tag(const std::string *nm, bool hi, uint32_t ht) +Tag::Tag(const std::string *nm, bool hi, int32_t ht) : name(nm) , ncap(Tag::RIGHTMOST) , base(Tag::RIGHTMOST) , dist(Tag::VARDIST) , history(hi) , orbit(false) - , height(fix_height(ncap, ht)) + , height(ht) {} -Tag::Tag(size_t nc, bool ob, uint32_t ht) +Tag::Tag(size_t nc, bool ob, int32_t ht) : name(NULL) , ncap(nc) , base(Tag::RIGHTMOST) , dist(Tag::VARDIST) , history(false) , orbit(ob) - , height(fix_height(ncap, ht)) + , height(ht) {} - -uint32_t fix_height(size_t ncap, uint32_t height) -{ - // height of the closing parenthesis is one less - // than height of the opening parenthesis - return ncap % 2 == 0 ? height + 1 : height; -} - } // namespace re2c diff --git a/re2c/src/re/tag.h b/re2c/src/re/tag.h index b6482a73..e44295b4 100644 --- a/re2c/src/re/tag.h +++ b/re2c/src/re/tag.h @@ -3,6 +3,7 @@ #include #include "src/util/c99_stdint.h" +#include "src/util/static_assert.h" #include #include @@ -11,19 +12,16 @@ namespace re2c typedef int32_t tagver_t; - static const tagver_t TAGVER_BOTTOM = std::numeric_limits::min(); // default value, lowest priority static const tagver_t TAGVER_ZERO = 0; // absense of tag static const tagver_t TAGVER_CURSOR = std::numeric_limits::max(); // current position, highest priority - struct tag_info_t { uint32_t idx : 31; uint32_t neg : 1; }; - struct Tag { static const size_t RIGHTMOST; @@ -36,43 +34,45 @@ struct Tag size_t dist; bool history; bool orbit; - uint32_t height; + int32_t height; - Tag(const std::string *nm, bool hi, uint32_t ht); - Tag(size_t nc, bool ob, uint32_t ht); + Tag(const std::string *nm, bool hi, int32_t ht); + Tag(size_t nc, bool ob, int32_t ht); }; +inline bool operator == (const tag_info_t &x, const tag_info_t &y) +{ + // per-component comparison is slower + RE2C_STATIC_ASSERT(sizeof(tag_info_t) == sizeof(uint32_t)); + return *reinterpret_cast(&x) + == *reinterpret_cast(&y); +} inline bool fixed(const Tag &tag) { return tag.dist != Tag::VARDIST; } - inline bool fictive(const Tag &tag) { return tag.ncap == Tag::FICTIVE; } - inline bool capture(const Tag &tag) { return tag.ncap != Tag::RIGHTMOST; } - inline bool orbit(const Tag &tag) { return tag.orbit; } - inline bool trailing(const Tag &tag) { return !capture(tag) && tag.name == NULL; } - inline bool history(const Tag &tag) { return tag.history; diff --git a/re2c/test/posix_captures/basic/10.i--flex-syntax.c b/re2c/test/posix_captures/basic/10.i--flex-syntax.c index ec2b7aea..c5b32ccf 100644 --- a/re2c/test/posix_captures/basic/10.i--flex-syntax.c +++ b/re2c/test/posix_captures/basic/10.i--flex-syntax.c @@ -6,9 +6,11 @@ yych = *(YYMARKER = YYCURSOR); switch (yych) { case 'a': + yyt2 = yyt3 = yyt4 = yyt5 = NULL; yyt1 = YYCURSOR; goto yy3; case 'c': + yyt2 = yyt3 = NULL; yyt1 = YYCURSOR; goto yy5; default: goto yy2; @@ -65,12 +67,11 @@ yy8: } yy9: ++YYCURSOR; - yyt2 = yyt3 = yyt6 = yyt7 = NULL; + yyt6 = yyt7 = NULL; yyt5 = YYCURSOR; goto yy7; yy10: ++YYCURSOR; - yyt2 = yyt3 = yyt4 = yyt5 = NULL; goto yy7; } diff --git a/re2c/test/posix_captures/basic/12.i--flex-syntax.c b/re2c/test/posix_captures/basic/12.i--flex-syntax.c index 74ee05cf..5b9b7ce7 100644 --- a/re2c/test/posix_captures/basic/12.i--flex-syntax.c +++ b/re2c/test/posix_captures/basic/12.i--flex-syntax.c @@ -6,10 +6,11 @@ yych = *(YYMARKER = YYCURSOR); switch (yych) { case 'a': - yyt1 = YYCURSOR; + yyt1 = yyt2 = NULL; + yyt3 = YYCURSOR; goto yy3; case 'b': - yyt1 = YYCURSOR; + yyt3 = YYCURSOR; goto yy5; default: goto yy2; } @@ -42,7 +43,6 @@ yy5: } yy6: ++YYCURSOR; - yyt1 = yyt2 = NULL; yyt4 = YYCURSOR; yy7: yynmatch = 3; @@ -55,6 +55,7 @@ yy7: {} yy8: ++YYCURSOR; + yyt1 = yyt3; yyt3 = yyt4 = NULL; goto yy7; } diff --git a/re2c/test/posix_captures/basic/13.i--flex-syntax.c b/re2c/test/posix_captures/basic/13.i--flex-syntax.c index 74ee05cf..5b9b7ce7 100644 --- a/re2c/test/posix_captures/basic/13.i--flex-syntax.c +++ b/re2c/test/posix_captures/basic/13.i--flex-syntax.c @@ -6,10 +6,11 @@ yych = *(YYMARKER = YYCURSOR); switch (yych) { case 'a': - yyt1 = YYCURSOR; + yyt1 = yyt2 = NULL; + yyt3 = YYCURSOR; goto yy3; case 'b': - yyt1 = YYCURSOR; + yyt3 = YYCURSOR; goto yy5; default: goto yy2; } @@ -42,7 +43,6 @@ yy5: } yy6: ++YYCURSOR; - yyt1 = yyt2 = NULL; yyt4 = YYCURSOR; yy7: yynmatch = 3; @@ -55,6 +55,7 @@ yy7: {} yy8: ++YYCURSOR; + yyt1 = yyt3; yyt3 = yyt4 = NULL; goto yy7; } diff --git a/re2c/test/posix_captures/basic/15.i--flex-syntax.c b/re2c/test/posix_captures/basic/15.i--flex-syntax.c index 25df7b2d..10f96664 100644 --- a/re2c/test/posix_captures/basic/15.i--flex-syntax.c +++ b/re2c/test/posix_captures/basic/15.i--flex-syntax.c @@ -6,6 +6,7 @@ if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt3 = yyt5 = NULL; yyt1 = yyt2 = YYCURSOR; goto yy3; } @@ -26,7 +27,7 @@ yy4: if (yyaccept == 0) { goto yy2; } else { - yyt2 = yyt3 = NULL; + yyt2 = yyt5; yyt5 = YYCURSOR; goto yy8; } @@ -39,7 +40,7 @@ yy6: case 0x00: goto yy4; case 'a': case 'b': - yyt3 = YYCURSOR; + yyt4 = YYCURSOR; goto yy9; default: yyt2 = YYCURSOR; @@ -70,13 +71,13 @@ yy9: switch (yych) { case 0x00: yyt4 = yyt2; - yyt2 = yyt3 = NULL; + yyt2 = yyt5; yyt5 = YYCURSOR; goto yy8; case 'a': case 'b': - yyt2 = yyt3; - yyt3 = YYCURSOR; + yyt2 = yyt4; + yyt4 = YYCURSOR; goto yy9; default: yyt4 = yyt2; diff --git a/re2c/test/posix_captures/basic/19.i--flex-syntax.c b/re2c/test/posix_captures/basic/19.i--flex-syntax.c index c38420f3..ff1d0d74 100644 --- a/re2c/test/posix_captures/basic/19.i--flex-syntax.c +++ b/re2c/test/posix_captures/basic/19.i--flex-syntax.c @@ -2,11 +2,12 @@ { YYCTYPE yych; - if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; switch (yych) { case 'a': - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; default: yyt2 = yyt3 = yyt4 = yyt5 = NULL; @@ -27,7 +28,6 @@ yy3: switch (yych) { case 'a': goto yy4; default: - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; goto yy2; } @@ -35,9 +35,10 @@ yy4: yych = *++YYCURSOR; switch (yych) { case 'a': - yyt3 = YYCURSOR; + yyt2 = YYCURSOR; goto yy5; default: + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; @@ -46,19 +47,21 @@ yy5: yych = *++YYCURSOR; switch (yych) { case 'a': - yyt4 = YYCURSOR; + yyt3 = YYCURSOR; goto yy6; default: + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; } yy6: - yych = *++YYCURSOR; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; switch (yych) { case 'a': goto yy7; default: - yyt2 = yyt3; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; @@ -72,7 +75,7 @@ yy7: yyt2 = YYCURSOR; goto yy8; default: - yyt2 = yyt4; + yyt2 = yyt3; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; @@ -83,21 +86,10 @@ yy8: yych = *YYCURSOR; switch (yych) { case 'a': - yyt4 = YYCURSOR; - goto yy9; - default: - yyt2 = yyt4; - yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; - goto yy2; - } -yy9: - ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - switch (yych) { - case 'a': goto yy7; + goto yy6; default: + yyt2 = yyt3; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; diff --git a/re2c/test/posix_captures/basic/20.i--flex-syntax.c b/re2c/test/posix_captures/basic/20.i--flex-syntax.c index 87189ff9..c54e335e 100644 --- a/re2c/test/posix_captures/basic/20.i--flex-syntax.c +++ b/re2c/test/posix_captures/basic/20.i--flex-syntax.c @@ -11,19 +11,21 @@ yyt1 = YYCURSOR; goto yy2; case 'a': - yyt1 = yyt2 = yyt3 = YYCURSOR; + yyt3 = NULL; + yyt1 = yyt2 = yyt4 = YYCURSOR; goto yy5; default: - yyt1 = yyt2 = yyt3 = YYCURSOR; + yyt3 = NULL; + yyt1 = yyt2 = yyt4 = YYCURSOR; goto yy3; } yy2: yynmatch = 3; yypmatch[0] = yyt1; yypmatch[2] = yyt2; - yypmatch[3] = yyt5; - yypmatch[4] = yyt3; - yypmatch[5] = yyt4; + yypmatch[3] = yyt3; + yypmatch[4] = yyt4; + yypmatch[5] = yyt5; yypmatch[1] = YYCURSOR; {} yy3: @@ -40,20 +42,20 @@ yy4: yyt1 = YYCURSOR; goto yy2; case 1: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; default: - yyt2 = yyt5 = NULL; - yyt4 = YYCURSOR; + yyt2 = yyt3; + yyt5 = YYCURSOR; goto yy2; } yy5: yych = *++YYCURSOR; switch (yych) { case 0x00: - yyt2 = yyt5 = NULL; - yyt4 = YYCURSOR; + yyt2 = yyt3; + yyt5 = YYCURSOR; goto yy2; case 'a': goto yy8; default: goto yy7; @@ -69,8 +71,8 @@ yy7: yych = *YYCURSOR; switch (yych) { case 0x00: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt5 = YYCURSOR; @@ -83,11 +85,11 @@ yy8: yych = *++YYCURSOR; switch (yych) { case 0x00: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': - yyt4 = YYCURSOR; + yyt6 = YYCURSOR; goto yy12; default: goto yy9; } @@ -96,8 +98,8 @@ yy9: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case 0x00: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt5 = YYCURSOR; @@ -129,8 +131,8 @@ yy12: yych = *++YYCURSOR; switch (yych) { case 0x00: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt5 = YYCURSOR; @@ -160,8 +162,8 @@ yy15: switch (yych) { case 0x00: yyt2 = yyt5; - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt2 = YYCURSOR; @@ -172,9 +174,9 @@ yy16: yych = *++YYCURSOR; switch (yych) { case 0x00: - yyt2 = yyt4; - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt2 = yyt6; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt2 = YYCURSOR; @@ -187,23 +189,23 @@ yy17: yych = *++YYCURSOR; switch (yych) { case 0x00: - yyt2 = yyt4; - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt2 = yyt6; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': goto yy15; default: goto yy20; } yy18: ++YYCURSOR; - yyt2 = yyt5 = NULL; - yyt4 = YYCURSOR; + yyt2 = yyt3; + yyt5 = YYCURSOR; goto yy2; yy19: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt2 = yyt5 = NULL; - yyt4 = YYCURSOR; + yyt2 = yyt3; + yyt5 = YYCURSOR; goto yy2; } yyt2 = yyt5; @@ -216,8 +218,8 @@ yy20: switch (yych) { case 0x00: yyt2 = yyt5; - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt2 = yyt5; @@ -235,8 +237,8 @@ yy21: switch (yych) { case 0x00: yyt2 = yyt5; - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt5 = YYCURSOR; @@ -253,16 +255,16 @@ yy22: yyt5 = yyt2; goto yy14; default: - yyt2 = yyt5 = NULL; - yyt4 = YYCURSOR; + yyt2 = yyt3; + yyt5 = YYCURSOR; goto yy2; } yy23: yych = *++YYCURSOR; switch (yych) { case 0x00: - yyt2 = yyt5 = NULL; - yyt4 = YYCURSOR; + yyt2 = yyt3; + yyt5 = YYCURSOR; goto yy2; case 'a': goto yy21; default: @@ -276,8 +278,8 @@ yy24: yych = *YYCURSOR; switch (yych) { case 0x00: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': yyt3 = YYCURSOR; @@ -292,8 +294,8 @@ yy25: yych = *YYCURSOR; switch (yych) { case 0x00: - yyt3 = yyt4 = NULL; - yyt5 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; goto yy2; case 'a': goto yy15; default: goto yy20; diff --git a/re2c/test/posix_captures/leftmost2.i--posix-captures.c b/re2c/test/posix_captures/leftmost2.i--posix-captures.c index 124ac1ca..d80fb80f 100644 --- a/re2c/test/posix_captures/leftmost2.i--posix-captures.c +++ b/re2c/test/posix_captures/leftmost2.i--posix-captures.c @@ -8,7 +8,9 @@ case 'a': yyt1 = YYCURSOR; goto yy3; - case 'b': goto yy5; + case 'b': + yyt1 = yyt2 = NULL; + goto yy5; default: goto yy2; } yy2: @@ -33,7 +35,7 @@ yy4: {} yy5: ++YYCURSOR; - yyt1 = yyt2 = yyt3 = NULL; + yyt3 = NULL; goto yy4; } diff --git a/re2c/test/posix_captures/nullsubexpr/11.i--flex-syntax.c b/re2c/test/posix_captures/nullsubexpr/11.i--flex-syntax.c index c4cc2994..be0ca958 100644 --- a/re2c/test/posix_captures/nullsubexpr/11.i--flex-syntax.c +++ b/re2c/test/posix_captures/nullsubexpr/11.i--flex-syntax.c @@ -6,6 +6,7 @@ yych = *YYCURSOR; switch (yych) { case 'a': + yyt4 = yyt5 = NULL; yyt1 = yyt2 = YYCURSOR; goto yy3; case 'z': @@ -31,13 +32,13 @@ yy3: yych = *YYCURSOR; switch (yych) { case 'a': + yyt4 = yyt5 = NULL; yyt2 = YYCURSOR; goto yy3; case 'z': yyt2 = yyt4 = YYCURSOR; goto yy5; default: - yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; } @@ -47,6 +48,7 @@ yy5: yych = *YYCURSOR; switch (yych) { case 'a': + yyt4 = yyt5 = NULL; yyt2 = YYCURSOR; goto yy3; case 'z': diff --git a/re2c/test/posix_captures/osxbsdcritical/01.i--flex-syntax.c b/re2c/test/posix_captures/osxbsdcritical/01.i--flex-syntax.c index f33eabb0..77b1e339 100644 --- a/re2c/test/posix_captures/osxbsdcritical/01.i--flex-syntax.c +++ b/re2c/test/posix_captures/osxbsdcritical/01.i--flex-syntax.c @@ -7,9 +7,11 @@ switch (yych) { case 0x00: goto yy2; case 'b': + yyt3 = NULL; yyt1 = yyt2 = YYCURSOR; goto yy5; default: + yyt3 = NULL; yyt1 = YYCURSOR; goto yy3; } @@ -21,9 +23,7 @@ yy2: yy3: yych = *++YYCURSOR; switch (yych) { - case 'b': - yyt2 = NULL; - goto yy7; + case 'b': goto yy7; default: goto yy4; } yy4: @@ -32,9 +32,7 @@ yy4: yy5: yych = *++YYCURSOR; switch (yych) { - case 'b': - yyt2 = NULL; - goto yy7; + case 'b': goto yy7; default: goto yy6; } yy6: @@ -50,6 +48,7 @@ yy6: {} yy7: ++YYCURSOR; + yyt2 = yyt3; goto yy6; } diff --git a/re2c/test/posix_captures/osxbsdcritical/02.i--flex-syntax.c b/re2c/test/posix_captures/osxbsdcritical/02.i--flex-syntax.c index 4bdda914..3b4b6d91 100644 --- a/re2c/test/posix_captures/osxbsdcritical/02.i--flex-syntax.c +++ b/re2c/test/posix_captures/osxbsdcritical/02.i--flex-syntax.c @@ -6,9 +6,11 @@ yych = *(YYMARKER = YYCURSOR); switch (yych) { case 'a': + yyt3 = NULL; yyt1 = YYCURSOR; goto yy3; case 'b': + yyt3 = NULL; yyt1 = yyt2 = YYCURSOR; goto yy5; default: goto yy2; @@ -21,9 +23,7 @@ yy2: yy3: yych = *++YYCURSOR; switch (yych) { - case 'b': - yyt2 = NULL; - goto yy7; + case 'b': goto yy7; default: goto yy4; } yy4: @@ -32,9 +32,7 @@ yy4: yy5: yych = *++YYCURSOR; switch (yych) { - case 'b': - yyt2 = NULL; - goto yy7; + case 'b': goto yy7; default: goto yy6; } yy6: @@ -50,6 +48,7 @@ yy6: {} yy7: ++YYCURSOR; + yyt2 = yyt3; goto yy6; } diff --git a/re2c/test/posix_captures/osxbsdcritical/03.i--flex-syntax.c b/re2c/test/posix_captures/osxbsdcritical/03.i--flex-syntax.c index 06cd5e8b..3fb2f6b3 100644 --- a/re2c/test/posix_captures/osxbsdcritical/03.i--flex-syntax.c +++ b/re2c/test/posix_captures/osxbsdcritical/03.i--flex-syntax.c @@ -7,10 +7,12 @@ yych = *(YYMARKER = YYCURSOR); switch (yych) { case 'a': - yyt1 = yyt5 = YYCURSOR; + yyt7 = NULL; + yyt1 = yyt6 = YYCURSOR; goto yy3; case 'b': - yyt1 = yyt3 = yyt4 = yyt5 = YYCURSOR; + yyt7 = NULL; + yyt1 = yyt3 = yyt4 = yyt5 = yyt6 = YYCURSOR; goto yy6; default: goto yy2; } @@ -25,7 +27,8 @@ yy3: yych = *YYCURSOR; switch (yych) { case 'a': - yyt5 = YYCURSOR; + yyt7 = NULL; + yyt6 = YYCURSOR; goto yy3; case 'b': yyt4 = NULL; @@ -44,11 +47,18 @@ yy6: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { + case 'a': + yyt2 = yyt6; + yyt7 = NULL; + yyt6 = YYCURSOR; + goto yy3; case 'b': yyt4 = NULL; yyt2 = yyt3 = YYCURSOR; goto yy8; - default: goto yy9; + default: + yyt2 = yyt6; + goto yy7; } yy7: yynmatch = 3; @@ -56,7 +66,7 @@ yy7: yypmatch[2] = yyt2; yypmatch[3] = yyt3; yypmatch[4] = yyt4; - yypmatch[5] = yyt4; + yypmatch[5] = yyt5; yypmatch[1] = YYCURSOR; {} yy8: @@ -64,19 +74,24 @@ yy8: YYMARKER = ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy9: switch (yych) { case 'a': - yyt2 = yyt5; - yyt5 = YYCURSOR; + yyt2 = yyt6; + yyt4 = yyt7; + yyt5 = yyt7; + yyt7 = NULL; + yyt6 = YYCURSOR; goto yy3; case 'b': - yyt5 = yyt2; + yyt6 = yyt2; + yyt7 = yyt4; yyt4 = NULL; yyt2 = yyt3 = YYCURSOR; goto yy8; default: - yyt2 = yyt5; + yyt2 = yyt6; + yyt4 = yyt7; + yyt5 = yyt7; goto yy7; } } diff --git a/re2c/test/posix_captures/other/08.i--flex-syntax.c b/re2c/test/posix_captures/other/08.i--flex-syntax.c index f8683519..8de9b9e9 100644 --- a/re2c/test/posix_captures/other/08.i--flex-syntax.c +++ b/re2c/test/posix_captures/other/08.i--flex-syntax.c @@ -6,7 +6,7 @@ yych = *YYCURSOR; switch (yych) { case 'a': - yyt1 = yyt3 = YYCURSOR; + yyt1 = yyt2 = YYCURSOR; goto yy3; default: yyt2 = yyt3 = NULL; @@ -16,8 +16,8 @@ yy2: yynmatch = 2; yypmatch[0] = yyt1; - yypmatch[2] = yyt3; - yypmatch[3] = yyt2; + yypmatch[2] = yyt2; + yypmatch[3] = yyt3; yypmatch[1] = YYCURSOR; {} yy3: @@ -27,7 +27,7 @@ yy3: switch (yych) { case 'a': goto yy4; default: - yyt2 = YYCURSOR; + yyt3 = YYCURSOR; goto yy2; } yy4: @@ -36,10 +36,10 @@ yy4: yych = *YYCURSOR; switch (yych) { case 'a': - yyt3 = YYCURSOR; + yyt2 = YYCURSOR; goto yy3; default: - yyt2 = YYCURSOR; + yyt3 = YYCURSOR; goto yy2; } } diff --git a/re2c/test/posix_captures/other/11.i--flex-syntax.c b/re2c/test/posix_captures/other/11.i--flex-syntax.c index 7aa4f297..676775c6 100644 --- a/re2c/test/posix_captures/other/11.i--flex-syntax.c +++ b/re2c/test/posix_captures/other/11.i--flex-syntax.c @@ -7,6 +7,7 @@ yych = *(YYMARKER = YYCURSOR); switch (yych) { case 'a': + yyt3 = yyt4 = NULL; yyt1 = yyt2 = yyt5 = YYCURSOR; goto yy3; default: @@ -43,7 +44,7 @@ yy4: yyt3 = YYCURSOR; goto yy2; default: - yyt2 = yyt3; + yyt2 = yyt6; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; @@ -68,7 +69,7 @@ yy6: switch (yych) { case 'a': goto yy7; default: - yyt2 = yyt3 = NULL; + yyt2 = yyt4; yyt4 = YYCURSOR; goto yy2; } @@ -79,7 +80,7 @@ yy7: yych = *YYCURSOR; switch (yych) { case 'a': - yyt3 = YYCURSOR; + yyt6 = YYCURSOR; goto yy8; default: yyt4 = yyt5 = NULL; @@ -104,7 +105,7 @@ yy9: yyt2 = yyt5 = YYCURSOR; goto yy3; default: - yyt2 = yyt3; + yyt2 = yyt6; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy2; diff --git a/re2c/test/posix_captures/repetition/01.i--flex-syntax.c b/re2c/test/posix_captures/repetition/01.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/01.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/01.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/02.i--flex-syntax.c b/re2c/test/posix_captures/repetition/02.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/02.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/02.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/03.i--flex-syntax.c b/re2c/test/posix_captures/repetition/03.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/03.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/03.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/04.i--flex-syntax.c b/re2c/test/posix_captures/repetition/04.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/04.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/04.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/05.i--flex-syntax.c b/re2c/test/posix_captures/repetition/05.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/05.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/05.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/06.i--flex-syntax.c b/re2c/test/posix_captures/repetition/06.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/06.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/06.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/07.i--flex-syntax.c b/re2c/test/posix_captures/repetition/07.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/07.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/07.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } diff --git a/re2c/test/posix_captures/repetition/08.i--flex-syntax.c b/re2c/test/posix_captures/repetition/08.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/08.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/08.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/09.i--flex-syntax.c b/re2c/test/posix_captures/repetition/09.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/09.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/09.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/10.i--flex-syntax.c b/re2c/test/posix_captures/repetition/10.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/10.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/10.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/11.i--flex-syntax.c b/re2c/test/posix_captures/repetition/11.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/11.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/11.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/12.i--flex-syntax.c b/re2c/test/posix_captures/repetition/12.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/12.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/12.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/13.i--flex-syntax.c b/re2c/test/posix_captures/repetition/13.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/13.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/13.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/14.i--flex-syntax.c b/re2c/test/posix_captures/repetition/14.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/14.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/14.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } diff --git a/re2c/test/posix_captures/repetition/15.i--flex-syntax.c b/re2c/test/posix_captures/repetition/15.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/15.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/15.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/16.i--flex-syntax.c b/re2c/test/posix_captures/repetition/16.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/16.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/16.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/17.i--flex-syntax.c b/re2c/test/posix_captures/repetition/17.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/17.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/17.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/18.i--flex-syntax.c b/re2c/test/posix_captures/repetition/18.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/18.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/18.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/19.i--flex-syntax.c b/re2c/test/posix_captures/repetition/19.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/19.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/19.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/20.i--flex-syntax.c b/re2c/test/posix_captures/repetition/20.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/20.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/20.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/21.i--flex-syntax.c b/re2c/test/posix_captures/repetition/21.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/21.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/21.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } diff --git a/re2c/test/posix_captures/repetition/22.i--flex-syntax.c b/re2c/test/posix_captures/repetition/22.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/22.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/22.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/23.i--flex-syntax.c b/re2c/test/posix_captures/repetition/23.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/23.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/23.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/24.i--flex-syntax.c b/re2c/test/posix_captures/repetition/24.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/24.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/24.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/25.i--flex-syntax.c b/re2c/test/posix_captures/repetition/25.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/25.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/25.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/26.i--flex-syntax.c b/re2c/test/posix_captures/repetition/26.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/26.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/26.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/27.i--flex-syntax.c b/re2c/test/posix_captures/repetition/27.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/27.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/27.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/28.i--flex-syntax.c b/re2c/test/posix_captures/repetition/28.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/28.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/28.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } diff --git a/re2c/test/posix_captures/repetition/29.i--flex-syntax.c b/re2c/test/posix_captures/repetition/29.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/29.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/29.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/30.i--flex-syntax.c b/re2c/test/posix_captures/repetition/30.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/30.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/30.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/31.i--flex-syntax.c b/re2c/test/posix_captures/repetition/31.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/31.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/31.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/32.i--flex-syntax.c b/re2c/test/posix_captures/repetition/32.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/32.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/32.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/33.i--flex-syntax.c b/re2c/test/posix_captures/repetition/33.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/33.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/33.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/34.i--flex-syntax.c b/re2c/test/posix_captures/repetition/34.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/34.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/34.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/35.i--flex-syntax.c b/re2c/test/posix_captures/repetition/35.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/35.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/35.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } diff --git a/re2c/test/posix_captures/repetition/36.i--flex-syntax.c b/re2c/test/posix_captures/repetition/36.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/36.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/36.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/37.i--flex-syntax.c b/re2c/test/posix_captures/repetition/37.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/37.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/37.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/38.i--flex-syntax.c b/re2c/test/posix_captures/repetition/38.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/38.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/38.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/39.i--flex-syntax.c b/re2c/test/posix_captures/repetition/39.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/39.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/39.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/40.i--flex-syntax.c b/re2c/test/posix_captures/repetition/40.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/40.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/40.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/41.i--flex-syntax.c b/re2c/test/posix_captures/repetition/41.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/41.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/41.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/42.i--flex-syntax.c b/re2c/test/posix_captures/repetition/42.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/42.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/42.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } diff --git a/re2c/test/posix_captures/repetition/43.i--flex-syntax.c b/re2c/test/posix_captures/repetition/43.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/43.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/43.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/44.i--flex-syntax.c b/re2c/test/posix_captures/repetition/44.i--flex-syntax.c index 5d982296..cfe2e408 100644 --- a/re2c/test/posix_captures/repetition/44.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/44.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -25,11 +26,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt4 = yyt5 = NULL; - yyt3 = yyt6 = yyt7 = yyt9 = YYCURSOR; + yyt4 = yyt5 = yyt7 = yyt8 = NULL; + yyt2 = yyt3 = yyt6 = yyt9 = YYCURSOR; goto yy7; } - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; yy6: yynmatch = 7; @@ -52,11 +52,11 @@ yy7: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt7 = yyt8 = NULL; yyt10 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt7 = yyt2; yyt2 = yyt1; yyt9 = yyt10 = NULL; yyt8 = YYCURSOR; diff --git a/re2c/test/posix_captures/repetition/45.i--flex-syntax.c b/re2c/test/posix_captures/repetition/45.i--flex-syntax.c index 7c9bacb0..5ec9ec26 100644 --- a/re2c/test/posix_captures/repetition/45.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/45.i--flex-syntax.c @@ -5,6 +5,7 @@ if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *(YYMARKER = YYCURSOR); if (yych >= 0x01) { + yyt2 = yyt3 = NULL; yyt1 = yyt4 = YYCURSOR; goto yy3; } @@ -16,7 +17,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt3 = NULL; + yyt7 = yyt8 = NULL; yyt5 = yyt6 = yyt9 = YYCURSOR; goto yy5; } @@ -26,15 +27,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; - yyt7 = yyt8 = yyt15 = NULL; - yyt10 = yyt11 = yyt12 = yyt13 = yyt14 = YYCURSOR; + yyt12 = yyt13 = yyt16 = NULL; + yyt10 = yyt11 = yyt14 = yyt15 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { - yyt7 = yyt8 = NULL; + yyt12 = yyt13 = NULL; yyt10 = yyt11 = yyt14 = YYCURSOR; goto yy8; } - yyt12 = yyt13 = NULL; yyt15 = YYCURSOR; yy7: yynmatch = 10; @@ -63,36 +63,37 @@ yy8: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt9 = yyt12; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt16; + yyt8 = yyt16; + yyt9 = yyt15; yyt15 = YYCURSOR; goto yy7; } - yyt9 = yyt10 = NULL; - yyt8 = yyt11 = yyt12 = yyt14 = YYCURSOR; + yyt9 = yyt10 = yyt12 = yyt13 = NULL; + yyt2 = yyt8 = yyt11 = yyt14 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; - yyt12 = yyt13 = NULL; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; yyt15 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt3 = yyt15; + yyt4 = yyt16; + yyt5 = yyt16; + yyt6 = yyt15; + yyt7 = yyt15; + yyt12 = yyt2; yyt2 = yyt1; - yyt3 = yyt13; - yyt4 = yyt15; - yyt5 = yyt15; - yyt6 = yyt13; - yyt7 = yyt13; yyt14 = yyt15 = NULL; yyt13 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/46.i--flex-syntax.c b/re2c/test/posix_captures/repetition/46.i--flex-syntax.c index 1ae28e02..d12c1fd7 100644 --- a/re2c/test/posix_captures/repetition/46.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/46.i--flex-syntax.c @@ -5,7 +5,8 @@ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = YYCURSOR; + yyt2 = yyt3 = NULL; + yyt1 = yyt4 = YYCURSOR; goto yy3; } yynmatch = 1; @@ -15,7 +16,6 @@ yy3: yych = *++YYCURSOR; if (yych >= 0x01) goto yy5; - yyt2 = yyt3 = NULL; yyt5 = YYCURSOR; yy4: yynmatch = 4; @@ -30,6 +30,7 @@ yy4: {} yy5: ++YYCURSOR; + yyt2 = yyt1; yyt4 = yyt5 = NULL; yyt3 = YYCURSOR; goto yy4; diff --git a/re2c/test/posix_captures/repetition/47.i--flex-syntax.c b/re2c/test/posix_captures/repetition/47.i--flex-syntax.c index 09ce47a7..ca9bc347 100644 --- a/re2c/test/posix_captures/repetition/47.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/47.i--flex-syntax.c @@ -16,6 +16,7 @@ yy2: yy3: yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy5; } @@ -24,10 +25,10 @@ yy3: yy5: yych = *++YYCURSOR; if (yych >= 0x01) { - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy7; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy6: yynmatch = 4; @@ -43,11 +44,11 @@ yy6: yy7: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy6; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy6; diff --git a/re2c/test/posix_captures/repetition/48.i--flex-syntax.c b/re2c/test/posix_captures/repetition/48.i--flex-syntax.c index e1379f61..6b6d2ecd 100644 --- a/re2c/test/posix_captures/repetition/48.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/48.i--flex-syntax.c @@ -22,13 +22,14 @@ yy4: yy5: yych = *++YYCURSOR; if (yych <= 0x00) goto yy4; + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych >= 0x01) { + yyt4 = yyt5 = NULL; yyt2 = yyt6 = YYCURSOR; goto yy8; } - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; yy7: yynmatch = 4; @@ -44,18 +45,18 @@ yy7: yy8: yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; yych = *++YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy7; } ++YYCURSOR; + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy7; diff --git a/re2c/test/posix_captures/repetition/49.i--flex-syntax.c b/re2c/test/posix_captures/repetition/49.i--flex-syntax.c index 678a7a92..98ae0ded 100644 --- a/re2c/test/posix_captures/repetition/49.i--flex-syntax.c +++ b/re2c/test/posix_captures/repetition/49.i--flex-syntax.c @@ -5,7 +5,8 @@ if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych >= 0x01) { - yyt1 = yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt1 = yyt2 = yyt6 = YYCURSOR; goto yy3; } yyt2 = yyt3 = yyt4 = yyt5 = yyt6 = yyt7 = NULL; @@ -26,7 +27,6 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { - yyt4 = yyt5 = NULL; yyt3 = yyt7 = YYCURSOR; goto yy2; } @@ -34,11 +34,13 @@ yy3: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x00) { + yyt4 = yyt2; yyt6 = yyt7 = NULL; yyt3 = yyt5 = YYCURSOR; goto yy2; } - yyt2 = yyt4 = yyt6 = YYCURSOR; + yyt4 = yyt5 = NULL; + yyt2 = yyt6 = YYCURSOR; goto yy3; } -- 2.40.0