forked from qt-creator/qt-creator
inline parseLine()
this should be marginally faster and it allows turning a few members into locals.
This commit is contained in:
@@ -139,7 +139,6 @@ public:
|
|||||||
|
|
||||||
ProBlock *currentBlock();
|
ProBlock *currentBlock();
|
||||||
void updateItem();
|
void updateItem();
|
||||||
void parseLine(const QString &line);
|
|
||||||
void insertVariable(const ushort **pCur, const ushort *end);
|
void insertVariable(const ushort **pCur, const ushort *end);
|
||||||
void insertOperator(const char op);
|
void insertOperator(const char op);
|
||||||
void insertComment(const QString &comment);
|
void insertComment(const QString &comment);
|
||||||
@@ -154,9 +153,6 @@ public:
|
|||||||
QString m_proitem;
|
QString m_proitem;
|
||||||
QString m_pendingComment;
|
QString m_pendingComment;
|
||||||
ushort *m_proitemPtr;
|
ushort *m_proitemPtr;
|
||||||
bool m_contNextLine;
|
|
||||||
bool m_inQuote;
|
|
||||||
int m_parens;
|
|
||||||
|
|
||||||
enum StrState { NotStarted, Started, PutSpace };
|
enum StrState { NotStarted, Started, PutSpace };
|
||||||
|
|
||||||
@@ -287,29 +283,17 @@ bool ProFileEvaluator::Private::read(ProFile *pro, QTextStream *ts)
|
|||||||
// Parser state
|
// Parser state
|
||||||
m_block = 0;
|
m_block = 0;
|
||||||
m_commentItem = 0;
|
m_commentItem = 0;
|
||||||
m_inQuote = false;
|
|
||||||
m_parens = 0;
|
|
||||||
m_contNextLine = false;
|
|
||||||
m_lineNo = 1;
|
m_lineNo = 1;
|
||||||
m_blockstack.clear();
|
m_blockstack.clear();
|
||||||
m_blockstack.push(pro);
|
m_blockstack.push(pro);
|
||||||
|
|
||||||
|
int parens = 0;
|
||||||
|
bool inQuote = false;
|
||||||
|
bool escaped = false;
|
||||||
while (!ts->atEnd()) {
|
while (!ts->atEnd()) {
|
||||||
QString line = ts->readLine();
|
QString line = ts->readLine();
|
||||||
parseLine(line);
|
|
||||||
++m_lineNo;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProFileEvaluator::Private::parseLine(const QString &line)
|
|
||||||
{
|
|
||||||
const ushort *cur = (const ushort *)line.unicode(),
|
const ushort *cur = (const ushort *)line.unicode(),
|
||||||
*end = cur + line.length();
|
*end = cur + line.length();
|
||||||
int parens = m_parens;
|
|
||||||
bool inQuote = m_inQuote;
|
|
||||||
bool escaped = false;
|
|
||||||
|
|
||||||
m_proitem.reserve(line.length());
|
m_proitem.reserve(line.length());
|
||||||
m_proitemPtr = (ushort *)m_proitem.unicode();
|
m_proitemPtr = (ushort *)m_proitem.unicode();
|
||||||
nextItem:
|
nextItem:
|
||||||
@@ -387,17 +371,17 @@ void ProFileEvaluator::Private::parseLine(const QString &line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_proitemPtr = ptr;
|
m_proitemPtr = ptr;
|
||||||
m_contNextLine = escaped;
|
|
||||||
done:
|
done:
|
||||||
m_inQuote = inQuote;
|
if (escaped) {
|
||||||
m_parens = parens;
|
|
||||||
if (m_contNextLine) {
|
|
||||||
--m_proitemPtr;
|
--m_proitemPtr;
|
||||||
updateItem();
|
updateItem();
|
||||||
} else {
|
} else {
|
||||||
updateItem();
|
updateItem();
|
||||||
finalizeBlock();
|
finalizeBlock();
|
||||||
}
|
}
|
||||||
|
++m_lineNo;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileEvaluator::Private::finalizeBlock()
|
void ProFileEvaluator::Private::finalizeBlock()
|
||||||
|
|||||||
Reference in New Issue
Block a user