Fix build of lexgen tool
Use QMultiHash explicitly, and build list of values in a QSet via the range constructor. Task-number: QTBUG-131842 Change-Id: I9cbcddeada0bfd88b11515262f5476e5d59e0fad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit e1217cc52bd367b7e040edeb86700dc923df39a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
14bd53687f
commit
e4495d8321
@ -157,7 +157,7 @@ QString Class::definition() const
|
||||
Generator::Generator(const DFA &_dfa, const Config &config)
|
||||
: dfa(_dfa), cfg(config)
|
||||
{
|
||||
QList<InputType> lst = cfg.maxInputSet.toList();
|
||||
QList<InputType> lst(cfg.maxInputSet.cbegin(), cfg.maxInputSet.cend());
|
||||
std::sort(lst.begin(), lst.end());
|
||||
minInput = lst.first();
|
||||
maxInput = lst.last();
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
~LineStream()
|
||||
{
|
||||
if (!--shared->ref) {
|
||||
(*shared->stream) << endl;
|
||||
(*shared->stream) << Qt::endl;
|
||||
delete shared;
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ public:
|
||||
LineStream operator<<(const T &value)
|
||||
{ stream << indentStr; stream << value; return LineStream(&stream); }
|
||||
|
||||
inline void addNewLine() { stream << endl; }
|
||||
inline void addNewLine() { stream << Qt::endl; }
|
||||
|
||||
inline QString toString() const { stream.flush(); return output; }
|
||||
|
||||
|
@ -32,7 +32,7 @@ void NFA::addTransition(int from, InputType input, int to)
|
||||
assertValidState(from);
|
||||
assertValidState(to);
|
||||
|
||||
states[from].transitions.insertMulti(input, to);
|
||||
states[from].transitions.insert(input, to);
|
||||
}
|
||||
|
||||
void NFA::copyFrom(const NFA &other, int baseState)
|
||||
@ -449,12 +449,13 @@ DFA DFA::minimize() const
|
||||
}
|
||||
} while (!done);
|
||||
|
||||
QHash<int, int> statesToEliminate;
|
||||
for (int i = 0; i < count(); ++i)
|
||||
for (int j = 0; j < i; ++j)
|
||||
if (!inequivalentStates[i * count() + j]) {
|
||||
statesToEliminate.insertMulti(i, j);
|
||||
}
|
||||
QMultiHash<int, int> statesToEliminate;
|
||||
for (int i = 0; i < count(); ++i) {
|
||||
for (int j = 0; j < i; ++j) {
|
||||
if (!inequivalentStates[i * count() + j])
|
||||
statesToEliminate.insert(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
qDebug() << "states to eliminiate:" << statesToEliminate.count();
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
typedef QHash<InputType, int> TransitionMap;
|
||||
typedef QMultiHash<InputType, int> TransitionMap;
|
||||
|
||||
struct State
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user