From 923f4c5559b1f8b43e63d1013d91698e7496e28c Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Thu, 21 May 2015 14:38:13 +0100 Subject: [PATCH] Compare DFA states rather than labels. 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 | 2 +- re2c/src/dfa/dfa.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/re2c/src/codegen/go_construct.cc b/re2c/src/codegen/go_construct.cc index 3db733a7..70396c76 100644 --- a/re2c/src/codegen/go_construct.cc +++ b/re2c/src/codegen/go_construct.cc @@ -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 (NULL), s[0].to)); } diff --git a/re2c/src/dfa/dfa.cc b/re2c/src/dfa/dfa.cc index 6110a55d..ca1b6846 100644 --- a/re2c/src/dfa/dfa.cc +++ b/re2c/src/dfa/dfa.cc @@ -142,7 +142,7 @@ DFA::~DFA() void DFA::addState(State **a, State *s) { - s->label = nStates++; + ++nStates; s->next = *a; *a = s; -- 2.40.0