]> granicus.if.org Git - re2c/commitdiff
Compare DFA states rather than labels.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 21 May 2015 13:38:13 +0000 (14:38 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 21 May 2015 13:38:13 +0000 (14:38 +0100)
This is first step to postpone labelling states until all the
code is actually generated (in the form of some structure in
memory) and it's time to pretty-print it to file.

Labels shouldn't be mixed up with states (in particular, they
shouldn't be used as a state identifier).

re2c/src/codegen/go_construct.cc
re2c/src/dfa/dfa.cc

index 3db733a7d3d2d7f23e9906d77fd9bcf3e882ab9a..70396c769a450350d08d7f7a8d74cffb95013241 100644 (file)
@@ -72,7 +72,7 @@ Linear::Linear (const Span * s, uint32_t n, const State * next)
                }
                if (n == 1)
                {
-                       if (next == NULL || s[0].to->label != next->label)
+                       if (next == NULL || s[0].to != next)
                        {
                                branches.push_back (std::make_pair (static_cast<const Cond *> (NULL), s[0].to));
                        }
index 6110a55d16cff27f760c891379b3aa483fca37d8..ca1b68465378f47e0dbfe99fb1750a69ab2becd2 100644 (file)
@@ -142,7 +142,7 @@ DFA::~DFA()
 
 void DFA::addState(State **a, State *s)
 {
-       s->label = nStates++;
+       ++nStates;
        s->next = *a;
        *a = s;