]> granicus.if.org Git - re2c/commitdiff
Renamed a couple of structs.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 13 Aug 2018 21:43:16 +0000 (22:43 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 13 Aug 2018 21:43:16 +0000 (22:43 +0100)
13 files changed:
re2c/Makefile.am
re2c/src/dfa/closure.cc
re2c/src/dfa/determinization.cc
re2c/src/dfa/determinization.h
re2c/src/dfa/dfa.h
re2c/src/dfa/dump.cc
re2c/src/dfa/find_state.cc
re2c/src/dfa/tag_history.cc [moved from re2c/src/dfa/tagtree.cc with 80% similarity]
re2c/src/dfa/tag_history.h [moved from re2c/src/dfa/tagtree.h with 84% similarity]
re2c/src/dfa/tagver_table.cc [moved from re2c/src/dfa/tagpool.cc with 76% similarity]
re2c/src/dfa/tagver_table.h [moved from re2c/src/dfa/tagpool.h with 71% similarity]
re2c/src/dfa/tcmd.cc
re2c/src/dfa/tcmd.h

index abffc58709609173ca4aae76174634b4a788e6ab..6a2f2dbdb4b530f00be36ac6b2db6d1931a50d1b 100644 (file)
@@ -26,8 +26,8 @@ SRC_HDR = \
        src/dfa/determinization.h \
        src/dfa/dfa.h \
        src/dfa/dump.h \
-       src/dfa/tagpool.h \
-       src/dfa/tagtree.h \
+       src/dfa/tag_history.h \
+       src/dfa/tagver_table.h \
        src/dfa/tcmd.h \
        src/nfa/nfa.h \
        src/re/encoding/case.h \
@@ -109,8 +109,8 @@ SRC = \
        src/dfa/fillpoints.cc \
        src/dfa/find_state.cc \
        src/dfa/minimization.cc \
-       src/dfa/tagpool.cc \
-       src/dfa/tagtree.cc \
+       src/dfa/tag_history.cc \
+       src/dfa/tagver_table.cc \
        src/dfa/tcmd.cc \
        src/re/encoding/enc.cc \
        src/re/encoding/range_suffix.cc \
index 17e1f58f3c533e7d0181f77d665ef5f682c4ecdf..26c95982afac6aa44a8f9f26264392021b634a43 100644 (file)
@@ -11,7 +11,6 @@
 #include "src/conf/opt.h"
 #include "src/dfa/determinization.h"
 #include "src/dfa/dfa.h"
-#include "src/dfa/tagpool.h"
 #include "src/dfa/tcmd.h"
 #include "src/nfa/nfa.h"
 #include "src/re/rule.h"
@@ -192,7 +191,7 @@ nfa_state_t *explore(determ_context_t &ctx, nfa_state_t *q)
                case nfa_state_t::TAG:
                        if (q->arcidx == 0) {
                                x.state = q->tag.out;
-                               x.tlook = ctx.dc_tagtrie.push(x.tlook, q->tag.info);
+                               x.tlook = ctx.dc_taghistory.push(x.tlook, q->tag.info);
                                p = relax(ctx, x);
                                ++q->arcidx;
                        }
@@ -332,7 +331,7 @@ void closure_leftmost(determ_context_t &ctx)
                                        break;
                                case nfa_state_t::TAG:
                                        x.state = n->tag.out;
-                                       x.tlook = ctx.dc_tagtrie.push(x.tlook, n->tag.info);
+                                       x.tlook = ctx.dc_taghistory.push(x.tlook, n->tag.info);
                                        todo.push(x);
                                        break;
                                case nfa_state_t::RAN:
@@ -389,14 +388,14 @@ void generate_versions(determ_context_t &ctx)
        const std::vector<Tag> &tags = dfa.tags;
        const size_t ntag = tags.size();
        tagver_t &maxver = dfa.maxtagver;
-       Tagpool &tagpool = ctx.dc_tagpool;
-       tagver_t *vers = tagpool.buffer;
+       tagver_table_t &tvtbl = ctx.dc_tagvertbl;
+       tagver_t *vers = tvtbl.buffer;
        closure_t &clos = ctx.dc_closure;
-       tagtree_t &tagtree = ctx.dc_tagtrie;
+       tag_history_t &thist = ctx.dc_taghistory;
        newvers_t &newvers = ctx.dc_newvers;
 
        clositer_t b = clos.begin(), e = clos.end(), c;
-       newver_cmp_t cmp(tagtree);
+       newver_cmp_t cmp(thist);
        newvers_t newacts(cmp);
        tcmd_t *cmd = NULL;
 
@@ -408,12 +407,12 @@ void generate_versions(determ_context_t &ctx)
                const hidx_t l = c->tlook, h = c->ttran;
                if (h == HROOT) continue;
 
-               const tagver_t *vs = tagpool[c->tvers];
+               const tagver_t *vs = tvtbl[c->tvers];
                for (size_t t = 0; t < ntag; ++t) {
                        const Tag &tag = tags[t];
                        const tagver_t
-                               h0 = tagtree.last(h, t),
-                               l0 = tagtree.last(l, t);
+                               h0 = thist.last(h, t),
+                               l0 = thist.last(l, t);
 
                        if (h0 == TAGVER_ZERO) continue;
 
@@ -436,15 +435,17 @@ void generate_versions(determ_context_t &ctx)
                const hidx_t h = i->first.history;
                const size_t t = i->first.tag;
                if (history(tags[t])) {
-                       cmd = dfa.tcpool.make_add(cmd, abs(m), abs(v), tagtree, h, t);
+                       cmd = dfa.tcpool.make_add(cmd, abs(m), abs(v), thist, h, t);
                } else {
-                       cmd = dfa.tcpool.make_set(cmd, abs(m), tagtree.last(h, t));
+                       cmd = dfa.tcpool.make_set(cmd, abs(m), thist.last(h, t));
                }
        }
 
        // mark tags with history
        for (newvers_t::iterator j = newvers.begin(); j != newvers.end(); ++j) {
-               if (history(tags[j->first.tag])) dfa.mtagvers.insert(abs(j->second));
+               if (history(tags[j->first.tag])) {
+                       dfa.mtagvers.insert(abs(j->second));
+               }
        }
 
        // update tag versions in closure
@@ -452,11 +453,11 @@ void generate_versions(determ_context_t &ctx)
                const hidx_t h = c->ttran;
                if (h == HROOT) continue;
 
-               const tagver_t *vs = tagpool[c->tvers];
+               const tagver_t *vs = tvtbl[c->tvers];
                for (size_t t = 0; t < ntag; ++t) {
                        const tagver_t
                                v0 = vs[t],
-                               h0 = tagtree.last(h, t),
+                               h0 = thist.last(h, t),
                                v = history(tags[t]) ? v0 : TAGVER_ZERO;
                        if (h0 == TAGVER_ZERO) {
                                vers[t] = v0;
@@ -465,7 +466,7 @@ void generate_versions(determ_context_t &ctx)
                                vers[t] = newvers[x];
                        }
                }
-               c->tvers = tagpool.insert(vers);
+               c->tvers = tvtbl.insert(vers);
        }
 
        ctx.dc_actions = cmd;
index 2bff8819b82e9028f9fd12b3f7e9c173329d79f4..5e0a5ab3975ccb69244dcf255041552b8e41d1dd 100644 (file)
@@ -13,8 +13,6 @@
 #include "src/dfa/dfa.h"
 #include "src/dfa/determinization.h"
 #include "src/dfa/dump.h"
-#include "src/dfa/tagpool.h"
-#include "src/dfa/tagtree.h"
 #include "src/dfa/tcmd.h"
 #include "src/nfa/nfa.h"
 #include "src/re/rule.h"
@@ -70,10 +68,10 @@ static uint32_t init_tag_versions(determ_context_t &ctx)
        const size_t ntags = dfa.tags.size();
 
        // all-zero tag configuration must have static number zero
-       assert(ZERO_TAGS == ctx.dc_tagpool.insert_const(TAGVER_ZERO));
+       assert(ZERO_TAGS == ctx.dc_tagvertbl.insert_const(TAGVER_ZERO));
 
        // initial tag versions: [1 .. N]
-       const uint32_t INITIAL_TAGS = ctx.dc_tagpool.insert_succ(1);
+       const uint32_t INITIAL_TAGS = ctx.dc_tagvertbl.insert_succ(1);
 
        // other versions: [ .. -(N + 1)] and [N + 1 .. ]
        dfa.maxtagver = static_cast<tagver_t>(ntags);
@@ -178,7 +176,7 @@ void warn_nondeterministic_tags(const determ_context_t &ctx)
                        for (size_t t = rule.ltag; t < rule.htag; ++t) {
                                uniq.clear();
                                for (size_t m = l; m < u; ++m) {
-                                       uniq.insert(ctx.dc_tagpool[v[m]][t]);
+                                       uniq.insert(ctx.dc_tagvertbl[v[m]][t]);
                                }
                                maxv[t] = std::max(maxv[t], uniq.size());
                        }
@@ -213,11 +211,11 @@ determ_context_t::determ_context_t(const opt_t *opts, Warn &warn
        , dc_reached()
        , dc_closure()
        , dc_prectbl(NULL)
-       , dc_tagpool(nfa.tags.size())
-       , dc_tagtrie()
+       , dc_tagvertbl(nfa.tags.size())
+       , dc_taghistory()
        , dc_kernels()
        , dc_buffers(dc_allocator)
-       , dc_newvers(newver_cmp_t(dc_tagtrie))
+       , dc_newvers(newver_cmp_t(dc_taghistory))
        , dc_stack_topsort()
        , dc_stack_linear()
        , dc_stack_dfs()
index 3cb28cd9b3505f219425c433179b6f6e61276f90..35a88d46f4ff3d8c03a58ee2d61859dcb17e1612 100644 (file)
@@ -10,8 +10,8 @@
 
 #include "src/nfa/nfa.h"
 #include "src/dfa/dump.h"
-#include "src/dfa/tagpool.h"
-#include "src/dfa/tagtree.h"
+#include "src/dfa/tagver_table.h"
+#include "src/dfa/tag_history.h"
 #include "src/util/forbid_copy.h"
 #include "src/util/lookup.h"
 #include "src/util/slab_allocator.h"
@@ -60,9 +60,9 @@ struct newver_t
 
 struct newver_cmp_t
 {
-       tagtree_t &history;
+       tag_history_t &history;
 
-       explicit newver_cmp_t(tagtree_t &h) : history(h) {}
+       explicit newver_cmp_t(tag_history_t &h) : history(h) {}
        bool operator()(const newver_t &, const newver_t &) const;
 };
 
@@ -105,26 +105,26 @@ typedef lookup_t<const kernel_t*> kernels_t;
 struct determ_context_t
 {
        // determinization input
-       const opt_t             *dc_opts;      // options
-       Warn                    &dc_warn;      // warnings
-       const std::string       &dc_condname;  // the name of current condition (with -c)
-       const nfa_t             &dc_nfa;       // TNFA
+       const opt_t             *dc_opts;       // options
+       Warn                    &dc_warn;       // warnings
+       const std::string       &dc_condname;   // the name of current condition (with -c)
+       const nfa_t             &dc_nfa;        // TNFA
 
        // determinization output
-       dfa_t                   &dc_dfa;       // resulting TDFA
+       dfa_t                   &dc_dfa;        // resulting TDFA
 
        // temporary structures used by determinization
        allocator_t              dc_allocator;
-       uint32_t                 dc_origin;    // from-state of the current transition
-       uint32_t                 dc_target;    // to-state of the current transition
-       uint32_t                 dc_symbol;    // alphabet symbol of the current transition
-       tcmd_t                  *dc_actions;   // tag actions of the current transition
+       uint32_t                 dc_origin;     // from-state of the current transition
+       uint32_t                 dc_target;     // to-state of the current transition
+       uint32_t                 dc_symbol;     // alphabet symbol of the current transition
+       tcmd_t                  *dc_actions;    // tag actions of the current transition
        closure_t                dc_reached;
        closure_t                dc_closure;
-       prectable_t             *dc_prectbl;   // precedence table for Okui POSIX disambiguation
-       Tagpool                  dc_tagpool;
-       tagtree_t                dc_tagtrie;   // prefix trie of tag histories
-       kernels_t                dc_kernels;   // TDFA states under construction
+       prectable_t             *dc_prectbl;    // precedence table for Okui POSIX disambiguation
+       tagver_table_t           dc_tagvertbl;
+       tag_history_t            dc_taghistory; // prefix trie of tag histories
+       kernels_t                dc_kernels;    // TDFA states under construction
        kernel_buffers_t         dc_buffers;
        newvers_t                dc_newvers;
        std::stack<nfa_state_t*> dc_stack_topsort;
index a6a17ba1e552937df9e93c959975f027a4ac1914..ce27789af998e3754693cbf148479c220c761d6c 100644 (file)
@@ -17,7 +17,6 @@ namespace re2c
 
 struct nfa_t;
 struct opt_t;
-struct Tagpool;
 
 struct dfa_state_t
 {
index 98fa48709e3524f4c98fa2238a1f967436a23347..eaf96e9da88a95f0b8ab3f1415126ebae08c2f27 100644 (file)
@@ -8,8 +8,8 @@
 #include "src/dfa/dfa.h"
 #include "src/dfa/determinization.h"
 #include "src/dfa/dump.h"
-#include "src/dfa/tagpool.h"
-#include "src/dfa/tagtree.h"
+#include "src/dfa/tag_history.h"
+#include "src/dfa/tagver_table.h"
 #include "src/dfa/tcmd.h"
 #include "src/nfa/nfa.h"
 #include "src/re/rule.h"
@@ -21,7 +21,7 @@ namespace re2c
 
 static void dump_tcmd_or_tcid(tcmd_t *const *, const tcid_t *, size_t, const tcpool_t &);
 static const char *tagname(const Tag &);
-static void dump_tags(const Tagpool &, const tagtree_t &, hidx_t, uint32_t);
+static void dump_tags(const tagver_table_t &, const tag_history_t &, hidx_t, uint32_t);
 
 
 dump_dfa_t::dump_dfa_t(const opt_t *opts)
@@ -45,7 +45,7 @@ dump_dfa_t::~dump_dfa_t()
 }
 
 
-static void dump_history(const dfa_t &dfa, const tagtree_t &h, hidx_t i)
+static void dump_history(const dfa_t &dfa, const tag_history_t &h, hidx_t i)
 {
        if (i == HROOT) {
                fprintf(stderr, " /");
@@ -76,7 +76,8 @@ void dump_dfa_t::state(const determ_context_t &ctx, bool isnew)
        const uint32_t target = ctx.dc_target;
        const uint32_t symbol = ctx.dc_symbol;
        const dfa_t &dfa = ctx.dc_dfa;
-       const Tagpool &tagpool = ctx.dc_tagpool;
+       const tagver_table_t &tvtbl = ctx.dc_tagvertbl;
+       const tag_history_t &thist = ctx.dc_taghistory;
        uint32_t i;
 
        if (target == dfa_t::NIL) return;
@@ -96,7 +97,7 @@ void dump_dfa_t::state(const determ_context_t &ctx, bool isnew)
                        i, style, static_cast<uint32_t>(c->state - ctx.dc_nfa.states));
 
                if (c->tvers != ZERO_TAGS) {
-                       const tagver_t *vers = tagpool[c->tvers];
+                       const tagver_t *vers = tvtbl[c->tvers];
                        const size_t ntag = dfa.tags.size();
 
                        for (size_t t = 0; t < ntag; ++t) {
@@ -104,7 +105,7 @@ void dump_dfa_t::state(const determ_context_t &ctx, bool isnew)
                        }
 
                        if (c->tlook != HROOT) {
-                               dump_history(dfa, ctx.dc_tagtrie, c->tlook);
+                               dump_history(dfa, thist, c->tlook);
                        }
                }
 
@@ -119,7 +120,7 @@ void dump_dfa_t::state(const determ_context_t &ctx, bool isnew)
                uint32_t i = 0;
                for (c = b; c != e; ++c, ++i) {
                        fprintf(stderr, "  void -> 0:%u:w [style=dotted label=\"", i);
-                       dump_tags(tagpool, ctx.dc_tagtrie, c->ttran, c->tvers);
+                       dump_tags(tvtbl, thist, c->ttran, c->tvers);
                        fprintf(stderr, "\"]\n");
                }
        }
@@ -140,7 +141,7 @@ void dump_dfa_t::state(const determ_context_t &ctx, bool isnew)
                        fprintf(stderr,
                                "  %u:%u:e -> %s%u:%u:w [label=\"%u",
                                origin, c->origin, prefix, state, i, symbol);
-                       dump_tags(tagpool, ctx.dc_tagtrie, c->ttran, c->tvers);
+                       dump_tags(tvtbl, thist, c->ttran, c->tvers);
                        fprintf(stderr, "\"]\n");
                }
        }
@@ -271,25 +272,25 @@ const char *tagname(const Tag &t)
 }
 
 
-void dump_tags(const Tagpool &tagpool, const tagtree_t &tagtrie,
+void dump_tags(const tagver_table_t &tagvertbl, const tag_history_t &taghistory,
        hidx_t ttran, uint32_t tvers)
 {
        if (ttran == HROOT) return;
 
        fprintf(stderr, "/");
-       const tagver_t *vers = tagpool[tvers];
-       for (size_t i = 0; i < tagpool.ntags; ++i) {
+       const tagver_t *vers = tagvertbl[tvers];
+       for (size_t i = 0; i < tagvertbl.ntags; ++i) {
 
-               if (tagtrie.last(ttran, i) == TAGVER_ZERO) {
+               if (taghistory.last(ttran, i) == TAGVER_ZERO) {
                        continue;
                }
 
                fprintf(stderr, "%d", abs(vers[i]));
-               for (hidx_t t = ttran; t != HROOT; t = tagtrie.pred(t)) {
-                       if (tagtrie.tag(t) != i) {
+               for (hidx_t t = ttran; t != HROOT; t = taghistory.pred(t)) {
+                       if (taghistory.tag(t) != i) {
                                continue;
                        }
-                       else if (tagtrie.elem(t) < TAGVER_ZERO) {
+                       else if (taghistory.elem(t) < TAGVER_ZERO) {
                                fprintf(stderr, "&darr;");
                        }
                        else if (t > TAGVER_ZERO) {
index 3b68795ef14c3407331af242c6134c2ccba3f8c8..05a057b2f5df0cd8ed49cdcdcf904176312b02bc 100644 (file)
@@ -7,7 +7,6 @@
 #include "src/dfa/determinization.h"
 #include "src/dfa/dfa.h"
 #include "src/dfa/dump.h"
-#include "src/dfa/tagpool.h"
 #include "src/dfa/tcmd.h"
 #include "src/nfa/nfa.h"
 #include "src/re/rule.h"
@@ -236,19 +235,19 @@ bool equal_lookahead_tags(const kernel_t *x, const kernel_t *y, const determ_con
                return true;
        }
 
-       const tagtree_t &trie = ctx.dc_tagtrie;
-       const Tagpool &tagpool = ctx.dc_tagpool;
+       const tag_history_t &thist = ctx.dc_taghistory;
+       const tagver_table_t &tvtbl = ctx.dc_tagvertbl;
        const std::vector<Tag> &tags = ctx.dc_dfa.tags;
 
        for (size_t i = 0; i < x->size; ++i) {
                const hidx_t xl = x->tlook[i], yl = y->tlook[i];
-               for (size_t t = 0; t < tagpool.ntags; ++t) {
+               for (size_t t = 0; t < tvtbl.ntags; ++t) {
                        if (history(tags[t])) {
                                // compare full tag sequences
-                               if (trie.compare_reversed(xl, yl, t) != 0) return false;
+                               if (thist.compare_reversed(xl, yl, t) != 0) return false;
                        } else {
                                // compare only the last pair of tags
-                               if (trie.last(xl, t) != trie.last(yl, t)) return false;
+                               if (thist.last(xl, t) != thist.last(yl, t)) return false;
                        }
                }
        }
@@ -293,13 +292,13 @@ bool kernel_map_t::operator()(const kernel_t *x, const kernel_t *y)
        std::fill(y2x - max, y2x + max, TAGVER_ZERO);
        for (size_t i = 0; i < n; ++i) {
                const tagver_t
-                       *xvs = ctx.dc_tagpool[x->tvers[i]],
-                       *yvs = ctx.dc_tagpool[y->tvers[i]];
+                       *xvs = ctx.dc_tagvertbl[x->tvers[i]],
+                       *yvs = ctx.dc_tagvertbl[y->tvers[i]];
                const hidx_t xl = x->tlook[i];
 
                for (size_t t = 0; t < ntag; ++t) {
                        // see note [mapping ignores items with lookahead tags]
-                       if (ctx.dc_tagtrie.last(xl, t) != TAGVER_ZERO
+                       if (ctx.dc_taghistory.last(xl, t) != TAGVER_ZERO
                                && !history(tags[t])) continue;
 
                        const tagver_t xv = xvs[t], yv = yvs[t];
@@ -407,9 +406,9 @@ tcmd_t *final_actions(determ_context_t &ctx, const clos_t &fin)
 {
        dfa_t &dfa = ctx.dc_dfa;
        const Rule &rule = dfa.rules[fin.state->rule];
-       const tagver_t *vers = ctx.dc_tagpool[fin.tvers];
+       const tagver_t *vers = ctx.dc_tagvertbl[fin.tvers];
        const hidx_t look = fin.tlook;
-       const tagtree_t &hist = ctx.dc_tagtrie;
+       const tag_history_t &thist = ctx.dc_taghistory;
        tcpool_t &tcpool = dfa.tcpool;
        tcmd_t *copy = NULL, *save = NULL, **p;
 
@@ -418,12 +417,12 @@ tcmd_t *final_actions(determ_context_t &ctx, const clos_t &fin)
                const Tag &tag = dfa.tags[t];
                if (fixed(tag)) continue;
 
-               const tagver_t v = abs(vers[t]), l = hist.last(look, t);
+               const tagver_t v = abs(vers[t]), l = thist.last(look, t);
                tagver_t &f = dfa.finvers[t];
                if (l == TAGVER_ZERO) {
                        copy = tcpool.make_copy(copy, f, v);
                } else if (history(tag)) {
-                       save = tcpool.make_add(save, f, v, hist, look, t);
+                       save = tcpool.make_add(save, f, v, thist, look, t);
                } else {
                        save = tcpool.make_set(save, f, l);
                }
similarity index 80%
rename from re2c/src/dfa/tagtree.cc
rename to re2c/src/dfa/tag_history.cc
index d984e50c03a9ea6a07042dc2be5209f9c0fea0a4..b2a82f0960d166726419949da2e03ccc185d9219 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 
 #include "src/dfa/determinization.h"
-#include "src/dfa/tagtree.h"
+#include "src/dfa/tag_history.h"
 
 
 namespace re2c
@@ -11,22 +11,22 @@ namespace re2c
 static const tagver_t DELIM = TAGVER_CURSOR - 1;
 
 
-tagtree_t::tagtree_t(): nodes(), path1(), path2() {}
+tag_history_t::tag_history_t(): nodes(), path1(), path2() {}
 
 
-hidx_t tagtree_t::pred(hidx_t i) const { return nodes[i].pred; }
+hidx_t tag_history_t::pred(hidx_t i) const { return nodes[i].pred; }
 
 
-tag_info_t tagtree_t::info(hidx_t i) const { return nodes[i].info; }
+tag_info_t tag_history_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; }
+tagver_t tag_history_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; }
+size_t tag_history_t::tag(hidx_t i) const { return nodes[i].info.idx; }
 
 
-hidx_t tagtree_t::push(hidx_t idx, tag_info_t info)
+hidx_t tag_history_t::push(hidx_t idx, tag_info_t info)
 {
        node_t x = {idx, info};
        nodes.push_back(x);
@@ -34,7 +34,7 @@ hidx_t tagtree_t::push(hidx_t idx, tag_info_t info)
 }
 
 
-tagver_t tagtree_t::last(hidx_t i, size_t t) const
+tagver_t tag_history_t::last(hidx_t i, size_t t) const
 {
        for (; i != HROOT; i = pred(i)) {
                if (tag(i) == t) return elem(i);
@@ -43,7 +43,7 @@ tagver_t tagtree_t::last(hidx_t i, size_t t) const
 }
 
 
-int32_t tagtree_t::compare_reversed(hidx_t x, hidx_t y, size_t t) const
+int32_t tag_history_t::compare_reversed(hidx_t x, hidx_t y, size_t t) const
 {
        // compare in reverse, from tail to head: direction makes
        // no difference when comparing for exact coincidence
@@ -61,7 +61,7 @@ int32_t tagtree_t::compare_reversed(hidx_t x, hidx_t y, size_t t) const
 }
 
 
-static void reconstruct_history(const tagtree_t &history,
+static void reconstruct_history(const tag_history_t &history,
        tag_path_t &path, hidx_t idx)
 {
        path.clear();
@@ -96,10 +96,10 @@ int32_t precedence(determ_context_t &ctx,
                return 0;
        }
 
-       tagtree_t &trie = ctx.dc_tagtrie;
-       tag_path_t &p1 = trie.path1, &p2 = trie.path2;
-       reconstruct_history(trie, p1, xl);
-       reconstruct_history(trie, p2, yl);
+       tag_history_t &thist = ctx.dc_taghistory;
+       tag_path_t &p1 = thist.path1, &p2 = thist.path2;
+       reconstruct_history(thist, p1, xl);
+       reconstruct_history(thist, p2, yl);
        tag_path_t::const_reverse_iterator
                i1 = p1.rbegin(), e1 = p1.rend(), j1 = i1, g1,
                i2 = p2.rbegin(), e2 = p2.rend(), j2 = i2, g2;
similarity index 84%
rename from re2c/src/dfa/tagtree.h
rename to re2c/src/dfa/tag_history.h
index f13bd120fe4ba04a5104dfcbd11517df46fdf6d7..bca3d1d9eb44e9dc1e105a17e36acf99e03bb380 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _RE2C_DFA_TAGTREE_
-#define _RE2C_DFA_TAGTREE_
+#ifndef _RE2C_DFA_TAG_HISTORY_
+#define _RE2C_DFA_TAG_HISTORY_
 
 #include <stddef.h>
 #include "src/util/c99_stdint.h"
@@ -20,7 +20,7 @@ static const hidx_t HROOT = ~0u;
 
 typedef std::vector<tag_info_t> tag_path_t;
 
-struct tagtree_t
+struct tag_history_t
 {
        // the whole tree of tags found by the epsilon-closure
        // (a bunch of separate subtrees for each tag with common root)
@@ -34,7 +34,7 @@ struct tagtree_t
        tag_path_t path1;
        tag_path_t path2;
 
-       tagtree_t();
+       tag_history_t();
        hidx_t pred(hidx_t i) const;
        tag_info_t info(hidx_t i) const;
        tagver_t elem(hidx_t i) const;
@@ -43,9 +43,9 @@ struct tagtree_t
        tagver_t last(hidx_t i, size_t t) const;
        int32_t compare_reversed(hidx_t x, hidx_t y, size_t t) const;
 
-       FORBID_COPY(tagtree_t);
+       FORBID_COPY(tag_history_t);
 };
 
 } // namespace re2c
 
-#endif // _RE2C_DFA_TAGTREE_
+#endif // _RE2C_DFA_TAG_HISTORY_
similarity index 76%
rename from re2c/src/dfa/tagpool.cc
rename to re2c/src/dfa/tagver_table.cc
index f2756aace317cdc784e9a32ab4d9f5d56db9e9d2..e4ee24cb61d1f2648a875989e5f233cd71d1e59b 100644 (file)
@@ -2,7 +2,7 @@
 #include <string.h> // memcpy, memcmp
 #include <algorithm>
 
-#include "src/dfa/tagpool.h"
+#include "src/dfa/tagver_table.h"
 #include "src/util/hash32.h"
 
 namespace re2c
@@ -20,14 +20,14 @@ struct eqtag_t
 };
 
 
-Tagpool::Tagpool(size_t n)
+tagver_table_t::tagver_table_t(size_t n)
        : lookup()
        , ntags(n)
        , buffer(new tagver_t[n])
 {}
 
 
-Tagpool::~Tagpool()
+tagver_table_t::~tagver_table_t()
 {
        delete[] buffer;
        const size_t n = lookup.size();
@@ -37,14 +37,14 @@ Tagpool::~Tagpool()
 }
 
 
-uint32_t Tagpool::insert_const(tagver_t ver)
+uint32_t tagver_table_t::insert_const(tagver_t ver)
 {
        std::fill(buffer, buffer + ntags, ver);
        return insert(buffer);
 }
 
 
-uint32_t Tagpool::insert_succ(tagver_t fst)
+uint32_t tagver_table_t::insert_succ(tagver_t fst)
 {
        for (uint32_t i = 0; i < ntags; ++i) {
                buffer[i] = fst++;
@@ -53,7 +53,7 @@ uint32_t Tagpool::insert_succ(tagver_t fst)
 }
 
 
-uint32_t Tagpool::insert(const tagver_t *tags)
+uint32_t tagver_table_t::insert(const tagver_t *tags)
 {
        const size_t size = ntags * sizeof(tagver_t);
        const uint32_t hash = hash32(0, tags, size);
@@ -70,7 +70,7 @@ uint32_t Tagpool::insert(const tagver_t *tags)
 }
 
 
-const tagver_t *Tagpool::operator[](uint32_t idx) const
+const tagver_t *tagver_table_t::operator[](uint32_t idx) const
 {
        return lookup[idx];
 }
similarity index 71%
rename from re2c/src/dfa/tagpool.h
rename to re2c/src/dfa/tagver_table.h
index 4f275379869715ee45b39081808f0586ed30a13e..4d584fa6710cc53014aba163a83761493dfbde54 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _RE2C_DFA_TAGPOOL_
-#define _RE2C_DFA_TAGPOOL_
+#ifndef _RE2C_DFA_TAGVER_TABLE_
+#define _RE2C_DFA_TAGVER_TABLE_
 
 #include <stddef.h>
 #include "src/util/c99_stdint.h"
@@ -14,7 +14,7 @@ namespace re2c
 
 static const size_t ZERO_TAGS = 0;
 
-struct Tagpool
+struct tagver_table_t
 {
 private:
        typedef lookup_t<const tagver_t*> taglookup_t;
@@ -24,15 +24,15 @@ public:
        const size_t ntags;
        tagver_t *buffer;
 
-       explicit Tagpool(size_t n);
-       ~Tagpool();
+       explicit tagver_table_t(size_t n);
+       ~tagver_table_t();
        uint32_t insert_const(tagver_t ver);
        uint32_t insert_succ(tagver_t fst);
        uint32_t insert(const tagver_t *tags);
        const tagver_t *operator[](uint32_t idx) const;
-       FORBID_COPY(Tagpool);
+       FORBID_COPY(tagver_table_t);
 };
 
 } // namespace re2c
 
-#endif // _RE2C_DFA_TAGPOOL_
+#endif // _RE2C_DFA_TAGVER_TABLE_
index 4fffd2d1190887b7d25388405d0474e23d9682a1..9fd9258d5b9652797fc2a49fac917ee0d0600140 100644 (file)
@@ -157,7 +157,7 @@ tcmd_t *tcpool_t::make_set(tcmd_t *next, tagver_t lhs, tagver_t set)
 
 
 tcmd_t *tcpool_t::make_add(tcmd_t *next, tagver_t lhs, tagver_t rhs,
-       const tagtree_t &history, hidx_t hidx, size_t tag)
+       const tag_history_t &history, hidx_t hidx, size_t tag)
 {
        size_t hlen = 0;
        for (hidx_t i = hidx; i != HROOT; i = history.pred(i)) {
index a2203f28bc6cc8961e79e8d73fa60269f50adb10..40f70b289265b4deb27a92afd5bd9026487f135a 100644 (file)
@@ -4,7 +4,7 @@
 #include <stddef.h>
 #include "src/util/c99_stdint.h"
 
-#include "src/dfa/tagtree.h"
+#include "src/dfa/tag_history.h"
 #include "src/re/tag.h"
 #include "src/util/lookup.h"
 #include "src/util/slab_allocator.h"
@@ -43,7 +43,7 @@ public:
        tcpool_t();
        tcmd_t *make_copy(tcmd_t *next, tagver_t lhs, tagver_t rhs);
        tcmd_t *make_set(tcmd_t *next, tagver_t lhs, tagver_t set);
-       tcmd_t *make_add(tcmd_t *next, tagver_t lhs, tagver_t rhs, const tagtree_t &history, hidx_t hidx, size_t tag);
+       tcmd_t *make_add(tcmd_t *next, tagver_t lhs, tagver_t rhs, const tag_history_t &history, hidx_t hidx, size_t tag);
        tcmd_t *copy_add(tcmd_t *next, tagver_t lhs, tagver_t rhs, const tagver_t *history);
        tcid_t insert(const tcmd_t *tcmd);
        const tcmd_t *operator[](tcid_t id) const;