summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/scxml/qscxmlcompiler.cpp (renamed from src/scxml/qscxmlparser.cpp)272
-rw-r--r--src/scxml/qscxmlcompiler.h (renamed from src/scxml/qscxmlparser.h)24
-rw-r--r--src/scxml/qscxmlcompiler_p.h (renamed from src/scxml/qscxmlparser_p.h)24
-rw-r--r--src/scxml/qscxmldatamodel_p.h2
-rw-r--r--src/scxml/qscxmlerror.cpp2
-rw-r--r--src/scxml/qscxmlexecutablecontent.cpp2
-rw-r--r--src/scxml/qscxmlexecutablecontent_p.h2
-rw-r--r--src/scxml/qscxmlstatemachine.cpp10
-rw-r--r--src/scxml/qscxmlstatemachine.h10
-rw-r--r--src/scxml/qscxmlstatemachine_p.h4
-rw-r--r--src/scxml/qscxmltabledata.cpp2
-rw-r--r--src/scxml/scxml.pro6
-rw-r--r--tests/auto/compiled/tst_compiled.cpp2
-rw-r--r--tests/auto/parser/tst_parser.cpp2
-rw-r--r--tests/auto/scion/tst_scion.cpp14
-rw-r--r--tests/auto/statemachine/tst_statemachine.cpp2
-rw-r--r--tools/qscxmlc/qscxmlc.cpp18
-rw-r--r--tools/qscxmlc/qscxmlc.pri6
-rw-r--r--tools/qscxmlc/scxmlcppdumper.h2
19 files changed, 202 insertions, 204 deletions
diff --git a/src/scxml/qscxmlparser.cpp b/src/scxml/qscxmlcompiler.cpp
index a5d37b4..9a3af4a 100644
--- a/src/scxml/qscxmlparser.cpp
+++ b/src/scxml/qscxmlcompiler.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qscxmlparser_p.h"
+#include "qscxmlcompiler_p.h"
#include "qscxmlexecutablecontent_p.h"
#include <QXmlStreamReader>
@@ -101,7 +101,7 @@ public:
continue;
#ifndef QT_NO_DEBUG
} else if (m_stateById.contains(state->id)) {
- Q_ASSERT(!"Should be unreachable: the parser should check for this case!");
+ Q_ASSERT(!"Should be unreachable: the compiler should check for this case!");
#endif // QT_NO_DEBUG
} else {
m_stateById[state->id] = state;
@@ -690,7 +690,7 @@ inline QScxmlInvokableService *InvokeDynamicScxmlFactory::invoke(
QScxmlScxmlService *QScxmlScxmlServiceFactory::invokeDynamic(
QScxmlStateMachine *parentStateMachine, const QString &sourceUrl)
{
- QScxmlParser::Loader *loader = parentStateMachine->loader();
+ QScxmlCompiler::Loader *loader = parentStateMachine->loader();
const QString baseDir = sourceUrl.isEmpty() ? QString() : QFileInfo(sourceUrl).path();
QStringList errs;
@@ -702,21 +702,21 @@ QScxmlScxmlService *QScxmlScxmlServiceFactory::invokeDynamic(
}
QXmlStreamReader reader(data);
- QScxmlParser parser(&reader);
- parser.setFileName(sourceUrl);
- parser.setLoader(parentStateMachine->loader());
- parser.parse();
- if (!parser.errors().isEmpty()) {
- const auto errors = parser.errors();
+ QScxmlCompiler compiler(&reader);
+ compiler.setFileName(sourceUrl);
+ compiler.setLoader(parentStateMachine->loader());
+ compiler.compile();
+ if (!compiler.errors().isEmpty()) {
+ const auto errors = compiler.errors();
for (const QScxmlError &error : errors)
qWarning() << error.toString();
return Q_NULLPTR;
}
- auto mainDoc = QScxmlParserPrivate::get(&parser)->scxmlDocument();
+ auto mainDoc = QScxmlCompilerPrivate::get(&compiler)->scxmlDocument();
if (mainDoc == nullptr) {
- Q_ASSERT(!parser.errors().isEmpty());
- const auto errors = parser.errors();
+ Q_ASSERT(!compiler.errors().isEmpty());
+ const auto errors = compiler.errors();
for (const QScxmlError &error : errors)
qWarning() << error.toString();
return Q_NULLPTR;
@@ -733,32 +733,32 @@ QScxmlScxmlService *QScxmlScxmlServiceFactory::invokeDynamic(
#endif // BUILD_QSCXMLC
/*!
- * \class QScxmlParser
- * \brief The QScxmlParser class is a parser for SCXML files.
+ * \class QScxmlCompiler
+ * \brief The QScxmlCompiler class is a compiler for SCXML files.
* \since 5.7
* \inmodule QtScxml
*
- * Parses an \l{SCXML Specification}{SCXML} file. It can also dynamically instantiate a
- * state machine for a successfully parsed SCXML file. If parsing failed and
- * instantiateStateMachine() is called, the new state machine cannot start. All errors are
- * returned by QScxmlStateMachine::parseErrors().
+ * Parses an \l{SCXML Specification}{SCXML} file and dynamically instantiates a
+ * state machine for a successfully parsed SCXML file. If parsing fails, the
+ * new state machine cannot start. All errors are returned by
+ * QScxmlStateMachine::parseErrors().
*
* To load an SCXML file, QScxmlStateMachine::fromFile or QScxmlStateMachine::fromData should be
- * used. Using QScxmlParser directly is only needed when the parser needs to use a custom
- * QScxmlParser::Loader.
+ * used. Using QScxmlCompiler directly is only needed when the compiler needs to use a custom
+ * QScxmlCompiler::Loader.
*/
/*!
- * Creates a new SCXML parser for the specified \a reader.
+ * Creates a new SCXML compiler for the specified \a reader.
*/
-QScxmlParser::QScxmlParser(QXmlStreamReader *reader)
- : d(new QScxmlParserPrivate(reader))
+QScxmlCompiler::QScxmlCompiler(QXmlStreamReader *reader)
+ : d(new QScxmlCompilerPrivate(reader))
{ }
/*!
- * Destroys the SCXML parser.
+ * Destroys the SCXML compiler.
*/
-QScxmlParser::~QScxmlParser()
+QScxmlCompiler::~QScxmlCompiler()
{
delete d;
}
@@ -768,7 +768,7 @@ QScxmlParser::~QScxmlParser()
*
* \sa setFileName()
*/
-QString QScxmlParser::fileName() const
+QString QScxmlCompiler::fileName() const
{
return d->fileName();
}
@@ -780,29 +780,29 @@ QString QScxmlParser::fileName() const
*
* \sa fileName()
*/
-void QScxmlParser::setFileName(const QString &fileName)
+void QScxmlCompiler::setFileName(const QString &fileName)
{
d->setFileName(fileName);
}
/*!
* Returns the loader that is currently used to resolve and load URIs for the
- * SCXML parser.
+ * SCXML compiler.
*
* \sa setLoader()
*/
-QScxmlParser::Loader *QScxmlParser::loader() const
+QScxmlCompiler::Loader *QScxmlCompiler::loader() const
{
return d->loader();
}
/*!
* Sets \a newLoader to be used for resolving and loading URIs for the SCXML
- * parser.
+ * compiler.
*
* \sa loader()
*/
-void QScxmlParser::setLoader(QScxmlParser::Loader *newLoader)
+void QScxmlCompiler::setLoader(QScxmlCompiler::Loader *newLoader)
{
d->setLoader(newLoader);
}
@@ -813,7 +813,7 @@ void QScxmlParser::setLoader(QScxmlParser::Loader *newLoader)
* If parsing is successful, the returned state machine can be initialized and started. If
* parsing fails, QScxmlStateMachine::parseErrors() can be used to retrieve a list of errors.
*/
-QScxmlStateMachine *QScxmlParser::parse()
+QScxmlStateMachine *QScxmlCompiler::compile()
{
d->readDocument();
if (d->errors().isEmpty()) {
@@ -833,9 +833,9 @@ QScxmlStateMachine *QScxmlParser::parse()
* parsing fails, QScxmlStateMachine::parseErrors() can be used to retrieve a list of errors.
*
* \note The instantiated state machine will not have an associated data model set.
- * \sa QScxmlParser::instantiateDataModel
+ * \sa QScxmlCompilerPrivate::instantiateDataModel
*/
-QScxmlStateMachine *QScxmlParserPrivate::instantiateStateMachine() const
+QScxmlStateMachine *QScxmlCompilerPrivate::instantiateStateMachine() const
{
#ifdef BUILD_QSCXMLC
return Q_NULLPTR;
@@ -866,7 +866,7 @@ QScxmlStateMachine *QScxmlParserPrivate::instantiateStateMachine() const
*
* After instantiation, the \a stateMachine takes ownership of the data model.
*/
-void QScxmlParserPrivate::instantiateDataModel(QScxmlStateMachine *stateMachine) const
+void QScxmlCompilerPrivate::instantiateDataModel(QScxmlStateMachine *stateMachine) const
{
#ifdef BUILD_QSCXMLC
Q_UNUSED(stateMachine)
@@ -888,12 +888,12 @@ void QScxmlParserPrivate::instantiateDataModel(QScxmlStateMachine *stateMachine)
/*!
* Returns the list of parse errors.
*/
-QVector<QScxmlError> QScxmlParser::errors() const
+QVector<QScxmlError> QScxmlCompiler::errors() const
{
return d->errors();
}
-bool QScxmlParserPrivate::ParserState::collectChars() {
+bool QScxmlCompilerPrivate::ParserState::collectChars() {
switch (kind) {
case Content:
case Data:
@@ -905,11 +905,11 @@ bool QScxmlParserPrivate::ParserState::collectChars() {
return false;
}
-bool QScxmlParserPrivate::ParserState::validChild(ParserState::Kind child) const {
+bool QScxmlCompilerPrivate::ParserState::validChild(ParserState::Kind child) const {
return validChild(kind, child);
}
-bool QScxmlParserPrivate::ParserState::validChild(ParserState::Kind parent, ParserState::Kind child)
+bool QScxmlCompilerPrivate::ParserState::validChild(ParserState::Kind parent, ParserState::Kind child)
{
switch (parent) {
case ParserState::Scxml:
@@ -1014,7 +1014,7 @@ bool QScxmlParserPrivate::ParserState::validChild(ParserState::Kind parent, Pars
return false;
}
-bool QScxmlParserPrivate::ParserState::isExecutableContent(ParserState::Kind kind) {
+bool QScxmlCompilerPrivate::ParserState::isExecutableContent(ParserState::Kind kind) {
switch (kind) {
case Raise:
case Send:
@@ -1032,7 +1032,7 @@ bool QScxmlParserPrivate::ParserState::isExecutableContent(ParserState::Kind kin
return false;
}
-QScxmlParserPrivate::ParserState::Kind QScxmlParserPrivate::ParserState::nameToParserStateKind(const QStringRef &name)
+QScxmlCompilerPrivate::ParserState::Kind QScxmlCompilerPrivate::ParserState::nameToParserStateKind(const QStringRef &name)
{
static QMap<QString, ParserState::Kind> nameToKind;
if (nameToKind.isEmpty()) {
@@ -1073,7 +1073,7 @@ QScxmlParserPrivate::ParserState::Kind QScxmlParserPrivate::ParserState::nameToP
return None;
}
-QStringList QScxmlParserPrivate::ParserState::requiredAttributes(QScxmlParserPrivate::ParserState::Kind kind)
+QStringList QScxmlCompilerPrivate::ParserState::requiredAttributes(QScxmlCompilerPrivate::ParserState::Kind kind)
{
switch (kind) {
case Scxml: return QStringList() << QStringLiteral("version");
@@ -1108,7 +1108,7 @@ QStringList QScxmlParserPrivate::ParserState::requiredAttributes(QScxmlParserPri
return QStringList();
}
-QStringList QScxmlParserPrivate::ParserState::optionalAttributes(QScxmlParserPrivate::ParserState::Kind kind)
+QStringList QScxmlCompilerPrivate::ParserState::optionalAttributes(QScxmlCompilerPrivate::ParserState::Kind kind)
{
switch (kind) {
case Scxml: return QStringList() << QStringLiteral("initial")
@@ -1309,27 +1309,27 @@ DocumentModel::NodeVisitor::~NodeVisitor()
{}
/*!
- * \class QScxmlParser::Loader
- * \brief The Loader class is a URI resolver and resource loader for an SCXML parser.
- * \since 5.7
+ * \class QScxmlCompiler::Loader
+ * \brief The Loader class is a URI resolver and resource loader for an SCXML compiler.
+ * \since 5.8
* \inmodule QtScxml
*/
/*!
* Creates a new loader.
*/
-QScxmlParser::Loader::Loader()
+QScxmlCompiler::Loader::Loader()
{
}
/*!
* Destroys the loader.
*/
-QScxmlParser::Loader::~Loader()
+QScxmlCompiler::Loader::~Loader()
{}
/*!
- * \fn QScxmlParser::Loader::load(const QString &name, const QString &baseDir, QStringList *errors)
+ * \fn QScxmlCompiler::Loader::load(const QString &name, const QString &baseDir, QStringList *errors)
* Resolves the URI \a name and loads an SCXML file from the directory
* specified by \a baseDir. \a errors contains information about the errors that
* might have occurred.
@@ -1337,18 +1337,18 @@ QScxmlParser::Loader::~Loader()
* Returns a QByteArray that stores the contents of the file.
*/
-QScxmlParserPrivate *QScxmlParserPrivate::get(QScxmlParser *parser)
+QScxmlCompilerPrivate *QScxmlCompilerPrivate::get(QScxmlCompiler *compiler)
{
- return parser->d;
+ return compiler->d;
}
-QScxmlParserPrivate::QScxmlParserPrivate(QXmlStreamReader *reader)
+QScxmlCompilerPrivate::QScxmlCompilerPrivate(QXmlStreamReader *reader)
: m_currentState(Q_NULLPTR)
, m_loader(&m_defaultLoader)
, m_reader(reader)
{}
-bool QScxmlParserPrivate::verifyDocument()
+bool QScxmlCompilerPrivate::verifyDocument()
{
if (!m_doc)
return false;
@@ -1363,36 +1363,36 @@ bool QScxmlParserPrivate::verifyDocument()
return false;
}
-DocumentModel::ScxmlDocument *QScxmlParserPrivate::scxmlDocument() const
+DocumentModel::ScxmlDocument *QScxmlCompilerPrivate::scxmlDocument() const
{
return m_doc && m_errors.isEmpty() ? m_doc.data() : Q_NULLPTR;
}
-QString QScxmlParserPrivate::fileName() const
+QString QScxmlCompilerPrivate::fileName() const
{
return m_fileName;
}
-void QScxmlParserPrivate::setFileName(const QString &fileName)
+void QScxmlCompilerPrivate::setFileName(const QString &fileName)
{
m_fileName = fileName;
}
-QScxmlParser::Loader *QScxmlParserPrivate::loader() const
+QScxmlCompiler::Loader *QScxmlCompilerPrivate::loader() const
{
return m_loader;
}
-void QScxmlParserPrivate::setLoader(QScxmlParser::Loader *loader)
+void QScxmlCompilerPrivate::setLoader(QScxmlCompiler::Loader *loader)
{
m_loader = loader;
}
-void QScxmlParserPrivate::parseSubDocument(DocumentModel::Invoke *parentInvoke,
+void QScxmlCompilerPrivate::parseSubDocument(DocumentModel::Invoke *parentInvoke,
QXmlStreamReader *reader,
const QString &fileName)
{
- QScxmlParser p(reader);
+ QScxmlCompiler p(reader);
p.setFileName(fileName);
p.setLoader(loader());
p.d->readDocument();
@@ -1401,11 +1401,11 @@ void QScxmlParserPrivate::parseSubDocument(DocumentModel::Invoke *parentInvoke,
m_errors.append(p.errors());
}
-bool QScxmlParserPrivate::parseSubElement(DocumentModel::Invoke *parentInvoke,
+bool QScxmlCompilerPrivate::parseSubElement(DocumentModel::Invoke *parentInvoke,
QXmlStreamReader *reader,
const QString &fileName)
{
- QScxmlParser p(reader);
+ QScxmlCompiler p(reader);
p.setFileName(fileName);
p.setLoader(loader());
p.d->resetDocument();
@@ -1416,7 +1416,7 @@ bool QScxmlParserPrivate::parseSubElement(DocumentModel::Invoke *parentInvoke,
return ok;
}
-bool QScxmlParserPrivate::preReadElementScxml()
+bool QScxmlCompilerPrivate::preReadElementScxml()
{
if (m_doc->root) {
addError(QLatin1String("Doc root already allocated"));
@@ -1475,7 +1475,7 @@ bool QScxmlParserPrivate::preReadElementScxml()
}
-bool QScxmlParserPrivate::preReadElementState()
+bool QScxmlCompilerPrivate::preReadElementState()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto newState = m_doc->newState(m_currentState, DocumentModel::State::Normal, xmlLocation());
@@ -1490,7 +1490,7 @@ bool QScxmlParserPrivate::preReadElementState()
return true;
}
-bool QScxmlParserPrivate::preReadElementParallel()
+bool QScxmlCompilerPrivate::preReadElementParallel()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto newState = m_doc->newState(m_currentState, DocumentModel::State::Parallel, xmlLocation());
@@ -1501,7 +1501,7 @@ bool QScxmlParserPrivate::preReadElementParallel()
return true;
}
-bool QScxmlParserPrivate::preReadElementInitial()
+bool QScxmlCompilerPrivate::preReadElementInitial()
{
DocumentModel::AbstractState *parent = currentParent();
if (!parent) {
@@ -1522,7 +1522,7 @@ bool QScxmlParserPrivate::preReadElementInitial()
return true;
}
-bool QScxmlParserPrivate::preReadElementTransition()
+bool QScxmlCompilerPrivate::preReadElementTransition()
{
// Parser stack at this point:
// <transition>
@@ -1566,7 +1566,7 @@ bool QScxmlParserPrivate::preReadElementTransition()
return true;
}
-bool QScxmlParserPrivate::preReadElementFinal()
+bool QScxmlCompilerPrivate::preReadElementFinal()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto newState = m_doc->newState(m_currentState, DocumentModel::State::Final, xmlLocation());
@@ -1576,7 +1576,7 @@ bool QScxmlParserPrivate::preReadElementFinal()
return true;
}
-bool QScxmlParserPrivate::preReadElementHistory()
+bool QScxmlCompilerPrivate::preReadElementHistory()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
@@ -1602,7 +1602,7 @@ bool QScxmlParserPrivate::preReadElementHistory()
return true;
}
-bool QScxmlParserPrivate::preReadElementOnEntry()
+bool QScxmlCompilerPrivate::preReadElementOnEntry()
{
const ParserState::Kind previousKind = previous().kind;
switch (previousKind) {
@@ -1621,7 +1621,7 @@ bool QScxmlParserPrivate::preReadElementOnEntry()
return true;
}
-bool QScxmlParserPrivate::preReadElementOnExit()
+bool QScxmlCompilerPrivate::preReadElementOnExit()
{
ParserState::Kind previousKind = previous().kind;
switch (previousKind) {
@@ -1640,7 +1640,7 @@ bool QScxmlParserPrivate::preReadElementOnExit()
return true;
}
-bool QScxmlParserPrivate::preReadElementRaise()
+bool QScxmlCompilerPrivate::preReadElementRaise()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto raise = m_doc->newNode<DocumentModel::Raise>(xmlLocation());
@@ -1649,7 +1649,7 @@ bool QScxmlParserPrivate::preReadElementRaise()
return true;
}
-bool QScxmlParserPrivate::preReadElementIf()
+bool QScxmlCompilerPrivate::preReadElementIf()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto *ifI = m_doc->newNode<DocumentModel::If>(xmlLocation());
@@ -1659,7 +1659,7 @@ bool QScxmlParserPrivate::preReadElementIf()
return true;
}
-bool QScxmlParserPrivate::preReadElementElseIf()
+bool QScxmlCompilerPrivate::preReadElementElseIf()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
@@ -1672,7 +1672,7 @@ bool QScxmlParserPrivate::preReadElementElseIf()
return true;
}
-bool QScxmlParserPrivate::preReadElementElse()
+bool QScxmlCompilerPrivate::preReadElementElse()
{
DocumentModel::If *ifI = lastIf();
if (!ifI)
@@ -1682,7 +1682,7 @@ bool QScxmlParserPrivate::preReadElementElse()
return true;
}
-bool QScxmlParserPrivate::preReadElementForeach()
+bool QScxmlCompilerPrivate::preReadElementForeach()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto foreachI = m_doc->newNode<DocumentModel::Foreach>(xmlLocation());
@@ -1694,7 +1694,7 @@ bool QScxmlParserPrivate::preReadElementForeach()
return true;
}
-bool QScxmlParserPrivate::preReadElementLog()
+bool QScxmlCompilerPrivate::preReadElementLog()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto logI = m_doc->newNode<DocumentModel::Log>(xmlLocation());
@@ -1704,12 +1704,12 @@ bool QScxmlParserPrivate::preReadElementLog()
return true;
}
-bool QScxmlParserPrivate::preReadElementDataModel()
+bool QScxmlCompilerPrivate::preReadElementDataModel()
{
return true;
}
-bool QScxmlParserPrivate::preReadElementData()
+bool QScxmlCompilerPrivate::preReadElementData()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto data = m_doc->newNode<DocumentModel::DataElement>(xmlLocation());
@@ -1726,7 +1726,7 @@ bool QScxmlParserPrivate::preReadElementData()
return true;
}
-bool QScxmlParserPrivate::preReadElementAssign()
+bool QScxmlCompilerPrivate::preReadElementAssign()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto assign = m_doc->newNode<DocumentModel::Assign>(xmlLocation());
@@ -1736,7 +1736,7 @@ bool QScxmlParserPrivate::preReadElementAssign()
return true;
}
-bool QScxmlParserPrivate::preReadElementDoneData()
+bool QScxmlCompilerPrivate::preReadElementDoneData()
{
DocumentModel::State *s = m_currentState->asState();
if (s && s->type == DocumentModel::State::Final) {
@@ -1751,7 +1751,7 @@ bool QScxmlParserPrivate::preReadElementDoneData()
return true;
}
-bool QScxmlParserPrivate::preReadElementContent()
+bool QScxmlCompilerPrivate::preReadElementContent()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
ParserState::Kind previousKind = previous().kind;
@@ -1781,7 +1781,7 @@ bool QScxmlParserPrivate::preReadElementContent()
return true;
}
-bool QScxmlParserPrivate::preReadElementParam()
+bool QScxmlCompilerPrivate::preReadElementParam()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto param = m_doc->newNode<DocumentModel::Param>(xmlLocation());
@@ -1813,7 +1813,7 @@ bool QScxmlParserPrivate::preReadElementParam()
return true;
}
-bool QScxmlParserPrivate::preReadElementScript()
+bool QScxmlCompilerPrivate::preReadElementScript()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto *script = m_doc->newNode<DocumentModel::Script>(xmlLocation());
@@ -1822,7 +1822,7 @@ bool QScxmlParserPrivate::preReadElementScript()
return true;
}
-bool QScxmlParserPrivate::preReadElementSend()
+bool QScxmlCompilerPrivate::preReadElementSend()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto *send = m_doc->newNode<DocumentModel::Send>(xmlLocation());
@@ -1842,7 +1842,7 @@ bool QScxmlParserPrivate::preReadElementSend()
return true;
}
-bool QScxmlParserPrivate::preReadElementCancel()
+bool QScxmlCompilerPrivate::preReadElementCancel()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
auto *cancel = m_doc->newNode<DocumentModel::Cancel>(xmlLocation());
@@ -1852,7 +1852,7 @@ bool QScxmlParserPrivate::preReadElementCancel()
return true;
}
-bool QScxmlParserPrivate::preReadElementInvoke()
+bool QScxmlCompilerPrivate::preReadElementInvoke()
{
const QXmlStreamAttributes attributes = m_reader->attributes();
DocumentModel::State *parentState = m_currentState->asState();
@@ -1883,7 +1883,7 @@ bool QScxmlParserPrivate::preReadElementInvoke()
return true;
}
-bool QScxmlParserPrivate::preReadElementFinalize()
+bool QScxmlCompilerPrivate::preReadElementFinalize()
{
auto instr = previous().instruction;
if (!instr) {
@@ -1899,91 +1899,91 @@ bool QScxmlParserPrivate::preReadElementFinalize()
return true;
}
-bool QScxmlParserPrivate::postReadElementScxml()
+bool QScxmlCompilerPrivate::postReadElementScxml()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementState()
+bool QScxmlCompilerPrivate::postReadElementState()
{
currentStateUp();
return true;
}
-bool QScxmlParserPrivate::postReadElementParallel()
+bool QScxmlCompilerPrivate::postReadElementParallel()
{
currentStateUp();
return true;
}
-bool QScxmlParserPrivate::postReadElementInitial()
+bool QScxmlCompilerPrivate::postReadElementInitial()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementTransition()
+bool QScxmlCompilerPrivate::postReadElementTransition()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementFinal()
+bool QScxmlCompilerPrivate::postReadElementFinal()
{
currentStateUp();
return true;
}
-bool QScxmlParserPrivate::postReadElementHistory()
+bool QScxmlCompilerPrivate::postReadElementHistory()
{
currentStateUp();
return true;
}
-bool QScxmlParserPrivate::postReadElementOnEntry()
+bool QScxmlCompilerPrivate::postReadElementOnEntry()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementOnExit()
+bool QScxmlCompilerPrivate::postReadElementOnExit()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementRaise()
+bool QScxmlCompilerPrivate::postReadElementRaise()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementIf()
+bool QScxmlCompilerPrivate::postReadElementIf()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementElseIf()
+bool QScxmlCompilerPrivate::postReadElementElseIf()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementElse()
+bool QScxmlCompilerPrivate::postReadElementElse()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementForeach()
+bool QScxmlCompilerPrivate::postReadElementForeach()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementLog()
+bool QScxmlCompilerPrivate::postReadElementLog()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementDataModel()
+bool QScxmlCompilerPrivate::postReadElementDataModel()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementData()
+bool QScxmlCompilerPrivate::postReadElementData()
{
const ParserState parserState = current();
DocumentModel::DataElement *data = Q_NULLPTR;
@@ -2030,17 +2030,17 @@ bool QScxmlParserPrivate::postReadElementData()
return true;
}
-bool QScxmlParserPrivate::postReadElementAssign()
+bool QScxmlCompilerPrivate::postReadElementAssign()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementDoneData()
+bool QScxmlCompilerPrivate::postReadElementDoneData()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementContent()
+bool QScxmlCompilerPrivate::postReadElementContent()
{
const ParserState parserState = current();
if (!parserState.chars.trimmed().isEmpty()) {
@@ -2059,12 +2059,12 @@ bool QScxmlParserPrivate::postReadElementContent()
return true;
}
-bool QScxmlParserPrivate::postReadElementParam()
+bool QScxmlCompilerPrivate::postReadElementParam()
{
return true;
}
-bool QScxmlParserPrivate::postReadElementScript()
+bool QScxmlCompilerPrivate::postReadElementScript()
{
const ParserState parserState = current();
DocumentModel::Script *scriptI = parserState.instruction->asScript();
@@ -2088,17 +2088,17 @@ bool QScxmlParserPrivate::postReadElementScript()
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementSend()
+bool QScxmlCompilerPrivate::postReadElementSend()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementCancel()
+bool QScxmlCompilerPrivate::postReadElementCancel()
{
return flushInstruction();
}
-bool QScxmlParserPrivate::postReadElementInvoke()
+bool QScxmlCompilerPrivate::postReadElementInvoke()
{
DocumentModel::Invoke *i = current().instruction->asInvoke();
const QString fileName = i->src;
@@ -2120,17 +2120,17 @@ bool QScxmlParserPrivate::postReadElementInvoke()
return true;
}
-bool QScxmlParserPrivate::postReadElementFinalize()
+bool QScxmlCompilerPrivate::postReadElementFinalize()
{
return true;
}
-void QScxmlParserPrivate::resetDocument()
+void QScxmlCompilerPrivate::resetDocument()
{
m_doc.reset(new DocumentModel::ScxmlDocument(fileName()));
}
-bool QScxmlParserPrivate::readDocument()
+bool QScxmlCompilerPrivate::readDocument()
{
resetDocument();
m_currentState = m_doc->root;
@@ -2176,7 +2176,7 @@ bool QScxmlParserPrivate::readDocument()
return true;
}
-bool QScxmlParserPrivate::readElement()
+bool QScxmlCompilerPrivate::readElement()
{
const QStringRef currentTag = m_reader->name();
const QXmlStreamAttributes attributes = m_reader->attributes();
@@ -2316,13 +2316,13 @@ bool QScxmlParserPrivate::readElement()
return true;
}
-void QScxmlParserPrivate::currentStateUp()
+void QScxmlCompilerPrivate::currentStateUp()
{
Q_ASSERT(m_currentState->parent);
m_currentState = m_currentState->parent;
}
-bool QScxmlParserPrivate::flushInstruction()
+bool QScxmlCompilerPrivate::flushInstruction()
{
if (!hasPrevious()) {
addError(QStringLiteral("missing instructionContainer"));
@@ -2338,7 +2338,7 @@ bool QScxmlParserPrivate::flushInstruction()
}
-QByteArray QScxmlParserPrivate::load(const QString &name, bool *ok)
+QByteArray QScxmlCompilerPrivate::load(const QString &name, bool *ok)
{
QStringList errs;
const QByteArray result = m_loader->load(name, m_fileName.isEmpty() ?
@@ -2351,32 +2351,32 @@ QByteArray QScxmlParserPrivate::load(const QString &name, bool *ok)
return result;
}
-QVector<QScxmlError> QScxmlParserPrivate::errors() const
+QVector<QScxmlError> QScxmlCompilerPrivate::errors() const
{
return m_errors;
}
-void QScxmlParserPrivate::addError(const QString &msg)
+void QScxmlCompilerPrivate::addError(const QString &msg)
{
m_errors.append(QScxmlError(m_fileName, m_reader->lineNumber(), m_reader->columnNumber(), msg));
}
-void QScxmlParserPrivate::addError(const DocumentModel::XmlLocation &location, const QString &msg)
+void QScxmlCompilerPrivate::addError(const DocumentModel::XmlLocation &location, const QString &msg)
{
m_errors.append(QScxmlError(m_fileName, location.line, location.column, msg));
}
-DocumentModel::AbstractState *QScxmlParserPrivate::currentParent() const
+DocumentModel::AbstractState *QScxmlCompilerPrivate::currentParent() const
{
return m_currentState ? m_currentState->asAbstractState() : Q_NULLPTR;
}
-DocumentModel::XmlLocation QScxmlParserPrivate::xmlLocation() const
+DocumentModel::XmlLocation QScxmlCompilerPrivate::xmlLocation() const
{
return DocumentModel::XmlLocation(m_reader->lineNumber(), m_reader->columnNumber());
}
-bool QScxmlParserPrivate::maybeId(const QXmlStreamAttributes &attributes, QString *id)
+bool QScxmlCompilerPrivate::maybeId(const QXmlStreamAttributes &attributes, QString *id)
{
Q_ASSERT(id);
QString idStr = attributes.value(QLatin1String("id")).toString();
@@ -2391,7 +2391,7 @@ bool QScxmlParserPrivate::maybeId(const QXmlStreamAttributes &attributes, QStrin
return true;
}
-DocumentModel::If *QScxmlParserPrivate::lastIf()
+DocumentModel::If *QScxmlCompilerPrivate::lastIf()
{
if (!hasPrevious()) {
addError(QStringLiteral("No previous instruction found for else block"));
@@ -2411,30 +2411,30 @@ DocumentModel::If *QScxmlParserPrivate::lastIf()
return ifI;
}
-QScxmlParserPrivate::ParserState &QScxmlParserPrivate::current()
+QScxmlCompilerPrivate::ParserState &QScxmlCompilerPrivate::current()
{
return m_stack.last();
}
-QScxmlParserPrivate::ParserState &QScxmlParserPrivate::previous()
+QScxmlCompilerPrivate::ParserState &QScxmlCompilerPrivate::previous()
{
return m_stack[m_stack.count() - 2];
}
-bool QScxmlParserPrivate::hasPrevious() const
+bool QScxmlCompilerPrivate::hasPrevious() const
{
return m_stack.count() > 1;
}
-bool QScxmlParserPrivate::checkAttributes(const QXmlStreamAttributes &attributes,
- QScxmlParserPrivate::ParserState::Kind kind)
+bool QScxmlCompilerPrivate::checkAttributes(const QXmlStreamAttributes &attributes,
+ QScxmlCompilerPrivate::ParserState::Kind kind)
{
return checkAttributes(attributes,
ParserState::requiredAttributes(kind),
ParserState::optionalAttributes(kind));
}
-bool QScxmlParserPrivate::checkAttributes(const QXmlStreamAttributes &attributes,
+bool QScxmlCompilerPrivate::checkAttributes(const QXmlStreamAttributes &attributes,
const QStringList &requiredNames,
const QStringList &optionalNames)
{
@@ -2458,11 +2458,11 @@ bool QScxmlParserPrivate::checkAttributes(const QXmlStreamAttributes &attributes
return true;
}
-QScxmlParserPrivate::DefaultLoader::DefaultLoader()
+QScxmlCompilerPrivate::DefaultLoader::DefaultLoader()
: Loader()
{}
-QByteArray QScxmlParserPrivate::DefaultLoader::load(const QString &name, const QString &baseDir, QStringList *errors)
+QByteArray QScxmlCompilerPrivate::DefaultLoader::load(const QString &name, const QString &baseDir, QStringList *errors)
{
QStringList errs;
QByteArray contents;
@@ -2496,7 +2496,7 @@ QByteArray QScxmlParserPrivate::DefaultLoader::load(const QString &name, const Q
return contents;
}
-QScxmlParserPrivate::ParserState::ParserState(QScxmlParserPrivate::ParserState::Kind someKind)
+QScxmlCompilerPrivate::ParserState::ParserState(QScxmlCompilerPrivate::ParserState::Kind someKind)
: kind(someKind)
, instruction(0)
, instructionContainer(0)
diff --git a/src/scxml/qscxmlparser.h b/src/scxml/qscxmlcompiler.h
index 19c3eed..411dfde 100644
--- a/src/scxml/qscxmlparser.h
+++ b/src/scxml/qscxmlcompiler.h
@@ -37,20 +37,18 @@
**
****************************************************************************/
-#ifndef SCXMLPARSER_H
-#define SCXMLPARSER_H
+#ifndef QSCXMLCOMPILER_H
+#define QSCXMLCOMPILER_H
#include <QtScxml/qscxmlerror.h>
-
-#include <QStringList>
-#include <QString>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
class QXmlStreamReader;
class QScxmlStateMachine;
-class QScxmlParserPrivate;
-class Q_SCXML_EXPORT QScxmlParser
+class QScxmlCompilerPrivate;
+class Q_SCXML_EXPORT QScxmlCompiler
{
public:
class Q_SCXML_EXPORT Loader
@@ -64,8 +62,8 @@ public:
};
public:
- QScxmlParser(QXmlStreamReader *xmlReader);
- ~QScxmlParser();
+ QScxmlCompiler(QXmlStreamReader *xmlReader);
+ ~QScxmlCompiler();
QString fileName() const;
void setFileName(const QString &fileName);
@@ -73,14 +71,14 @@ public:
Loader *loader() const;
void setLoader(Loader *newLoader);
- QScxmlStateMachine *parse();
+ QScxmlStateMachine *compile();
QVector<QScxmlError> errors() const;
private:
- friend class QScxmlParserPrivate;
- QScxmlParserPrivate *d;
+ friend class QScxmlCompilerPrivate;
+ QScxmlCompilerPrivate *d;
};
QT_END_NAMESPACE
-#endif // SCXMLPARSER_H
+#endif // QSCXMLCOMPILER_H
diff --git a/src/scxml/qscxmlparser_p.h b/src/scxml/qscxmlcompiler_p.h
index ee39b0e..6909c2c 100644
--- a/src/scxml/qscxmlparser_p.h
+++ b/src/scxml/qscxmlcompiler_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef SCXMLPARSER_P_H
-#define SCXMLPARSER_P_H
+#ifndef QSCXMLCOMPILER_P_H
+#define QSCXMLCOMPILER_P_H
//
// W A R N I N G
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qscxmlparser.h"
+#include "qscxmlcompiler.h"
#include <QDir>
#include <QFileInfo>
@@ -548,12 +548,12 @@ public:
} // DocumentModel namespace
-class Q_SCXML_EXPORT QScxmlParserPrivate
+class Q_SCXML_EXPORT QScxmlCompilerPrivate
{
public:
- static QScxmlParserPrivate *get(QScxmlParser *parser);
+ static QScxmlCompilerPrivate *get(QScxmlCompiler *compiler);
- QScxmlParserPrivate(QXmlStreamReader *reader);
+ QScxmlCompilerPrivate(QXmlStreamReader *reader);
bool verifyDocument();
DocumentModel::ScxmlDocument *scxmlDocument() const;
@@ -561,8 +561,8 @@ public:
QString fileName() const;
void setFileName(const QString &fileName);
- QScxmlParser::Loader *loader() const;
- void setLoader(QScxmlParser::Loader *loader);
+ QScxmlCompiler::Loader *loader() const;
+ void setLoader(QScxmlCompiler::Loader *loader);
bool readDocument();
void parseSubDocument(DocumentModel::Invoke *parentInvoke,
@@ -699,7 +699,7 @@ private:
};
public:
- class DefaultLoader: public QScxmlParser::Loader
+ class DefaultLoader: public QScxmlCompiler::Loader
{
public:
DefaultLoader();
@@ -709,7 +709,7 @@ public:
};
private:
- bool checkAttributes(const QXmlStreamAttributes &attributes, QScxmlParserPrivate::ParserState::Kind kind);
+ bool checkAttributes(const QXmlStreamAttributes &attributes, QScxmlCompilerPrivate::ParserState::Kind kind);
ParserState &current();
ParserState &previous();
bool hasPrevious() const;
@@ -721,7 +721,7 @@ private:
QScopedPointer<DocumentModel::ScxmlDocument> m_doc;
DocumentModel::StateContainer *m_currentState;
DefaultLoader m_defaultLoader;
- QScxmlParser::Loader *m_loader;
+ QScxmlCompiler::Loader *m_loader;
QXmlStreamReader *m_reader;
QVector<ParserState> m_stack;
@@ -730,4 +730,4 @@ private:
QT_END_NAMESPACE
-#endif // SCXMLPARSER_P_H
+#endif // QSCXMLCOMPILER_P_H
diff --git a/src/scxml/qscxmldatamodel_p.h b/src/scxml/qscxmldatamodel_p.h
index 1fdcfbb..089071a 100644
--- a/src/scxml/qscxmldatamodel_p.h
+++ b/src/scxml/qscxmldatamodel_p.h
@@ -52,7 +52,7 @@
//
#include "qscxmldatamodel.h"
-#include "qscxmlparser_p.h"
+#include "qscxmlcompiler_p.h"
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/scxml/qscxmlerror.cpp b/src/scxml/qscxmlerror.cpp
index 01811fc..84cf4fe 100644
--- a/src/scxml/qscxmlerror.cpp
+++ b/src/scxml/qscxmlerror.cpp
@@ -62,7 +62,7 @@ public:
* \since 5.7
* \inmodule QtScxml
*
- * \sa QScxmlStateMachine QScxmlParser
+ * \sa QScxmlStateMachine QScxmlCompiler
*/
/*!
diff --git a/src/scxml/qscxmlexecutablecontent.cpp b/src/scxml/qscxmlexecutablecontent.cpp
index c84fa92..5df8b1f 100644
--- a/src/scxml/qscxmlexecutablecontent.cpp
+++ b/src/scxml/qscxmlexecutablecontent.cpp
@@ -39,7 +39,7 @@
#include "qscxmlglobals_p.h"
#include "qscxmlexecutablecontent_p.h"
-#include "qscxmlparser_p.h"
+#include "qscxmlcompiler_p.h"
#include "qscxmlevent_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/scxml/qscxmlexecutablecontent_p.h b/src/scxml/qscxmlexecutablecontent_p.h
index 04b33a5..4429686 100644
--- a/src/scxml/qscxmlexecutablecontent_p.h
+++ b/src/scxml/qscxmlexecutablecontent_p.h
@@ -53,7 +53,7 @@
#include <QtScxml/qscxmlexecutablecontent.h>
#include <QtScxml/private/qscxmltabledata_p.h>
-#include <QtScxml/private/qscxmlparser_p.h>
+#include <QtScxml/private/qscxmlcompiler_p.h>
#include <QTextStream>
#ifndef BUILD_QSCXMLC
diff --git a/src/scxml/qscxmlstatemachine.cpp b/src/scxml/qscxmlstatemachine.cpp
index 98011a7..e761477 100644
--- a/src/scxml/qscxmlstatemachine.cpp
+++ b/src/scxml/qscxmlstatemachine.cpp
@@ -1419,9 +1419,9 @@ QScxmlStateMachine *QScxmlStateMachine::fromFile(const QString &fileName)
QScxmlStateMachine *QScxmlStateMachine::fromData(QIODevice *data, const QString &fileName)
{
QXmlStreamReader xmlReader(data);
- QScxmlParser parser(&xmlReader);
- parser.setFileName(fileName);
- return parser.parse();
+ QScxmlCompiler compiler(&xmlReader);
+ compiler.setFileName(fileName);
+ return compiler.compile();
}
QVector<QScxmlError> QScxmlStateMachine::parseErrors() const
@@ -1580,7 +1580,7 @@ QScxmlDataModel *QScxmlStateMachine::dataModel() const
return d->m_dataModel;
}
-void QScxmlStateMachine::setLoader(QScxmlParser::Loader *loader)
+void QScxmlStateMachine::setLoader(QScxmlCompiler::Loader *loader)
{
Q_D(QScxmlStateMachine);
@@ -1590,7 +1590,7 @@ void QScxmlStateMachine::setLoader(QScxmlParser::Loader *loader)
}
}
-QScxmlParser::Loader *QScxmlStateMachine::loader() const
+QScxmlCompiler::Loader *QScxmlStateMachine::loader() const
{
Q_D(const QScxmlStateMachine);
diff --git a/src/scxml/qscxmlstatemachine.h b/src/scxml/qscxmlstatemachine.h
index a3f833c..0750323 100644
--- a/src/scxml/qscxmlstatemachine.h
+++ b/src/scxml/qscxmlstatemachine.h
@@ -44,7 +44,7 @@
#include <QtScxml/qscxmlexecutablecontent.h>
#include <QtScxml/qscxmlerror.h>
#include <QtScxml/qscxmlevent.h>
-#include <QtScxml/qscxmlparser.h>
+#include <QtScxml/qscxmlcompiler.h>
#include <QString>
#include <QVector>
@@ -74,7 +74,7 @@ class Q_SCXML_EXPORT QScxmlStateMachine: public QObject
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(bool invoked READ isInvoked CONSTANT)
Q_PROPERTY(QVector<QScxmlError> parseErrors READ parseErrors CONSTANT)
- Q_PROPERTY(QScxmlParser::Loader *loader READ loader WRITE setLoader NOTIFY loaderChanged)
+ Q_PROPERTY(QScxmlCompiler::Loader *loader READ loader WRITE setLoader NOTIFY loaderChanged)
protected:
#ifndef Q_QDOC
@@ -95,8 +95,8 @@ public:
void setDataModel(QScxmlDataModel *model);
QScxmlDataModel *dataModel() const;
- void setLoader(QScxmlParser::Loader *loader);
- QScxmlParser::Loader *loader() const;
+ void setLoader(QScxmlCompiler::Loader *loader);
+ QScxmlCompiler::Loader *loader() const;
bool isRunning() const;
void setRunning(bool running);
@@ -323,7 +323,7 @@ Q_SIGNALS:
void dataModelChanged(QScxmlDataModel *model);
void initialValuesChanged(const QVariantMap &initialValues);
void initializedChanged(bool initialized);
- void loaderChanged(QScxmlParser::Loader *loader);
+ void loaderChanged(QScxmlCompiler::Loader *loader);
public Q_SLOTS:
void start();
diff --git a/src/scxml/qscxmlstatemachine_p.h b/src/scxml/qscxmlstatemachine_p.h
index a25a24c..69f3be4 100644
--- a/src/scxml/qscxmlstatemachine_p.h
+++ b/src/scxml/qscxmlstatemachine_p.h
@@ -331,8 +331,8 @@ public: // types & data fields:
bool m_isProcessingEvents;
QVariantMap m_initialValues;
QScxmlDataModel *m_dataModel;
- QScxmlParserPrivate::DefaultLoader m_defaultLoader;
- QScxmlParser::Loader *m_loader;
+ QScxmlCompilerPrivate::DefaultLoader m_defaultLoader;
+ QScxmlCompiler::Loader *m_loader;
QScxmlExecutionEngine *m_executionEngine;
QScxmlTableData *m_tableData;
const StateTable *m_stateTable;
diff --git a/src/scxml/qscxmltabledata.cpp b/src/scxml/qscxmltabledata.cpp
index c2e9dc6..3b9cabd 100644
--- a/src/scxml/qscxmltabledata.cpp
+++ b/src/scxml/qscxmltabledata.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qscxmltabledata_p.h"
-#include "qscxmlparser_p.h"
+#include "qscxmlcompiler_p.h"
#include "qscxmlexecutablecontent_p.h"
QT_USE_NAMESPACE
diff --git a/src/scxml/scxml.pro b/src/scxml/scxml.pro
index fa96789..2af47bf 100644
--- a/src/scxml/scxml.pro
+++ b/src/scxml/scxml.pro
@@ -10,8 +10,8 @@ CONFIG += $$MODULE_CONFIG
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
HEADERS += \
- qscxmlparser.h \
- qscxmlparser_p.h \
+ qscxmlcompiler.h \
+ qscxmlcompiler_p.h \
qscxmlstatemachine.h \
qscxmlstatemachine_p.h \
qscxmlglobals.h \
@@ -34,7 +34,7 @@ HEADERS += \
qscxmlstatemachineinfo_p.h
SOURCES += \
- qscxmlparser.cpp \
+ qscxmlcompiler.cpp \
qscxmlstatemachine.cpp \
qscxmlnulldatamodel.cpp \
qscxmlecmascriptdatamodel.cpp \
diff --git a/tests/auto/compiled/tst_compiled.cpp b/tests/auto/compiled/tst_compiled.cpp
index 6ee181d..ab590f7 100644
--- a/tests/auto/compiled/tst_compiled.cpp
+++ b/tests/auto/compiled/tst_compiled.cpp
@@ -29,7 +29,7 @@
#include <QtTest>
#include <QObject>
#include <QXmlStreamReader>
-#include <QtScxml/qscxmlparser.h>
+#include <QtScxml/qscxmlcompiler.h>
#include <QtScxml/qscxmlstatemachine.h>
#include <QtScxml/qscxmlinvokableservice.h>
#include "ids1.h"
diff --git a/tests/auto/parser/tst_parser.cpp b/tests/auto/parser/tst_parser.cpp
index 0a0c287..202e783 100644
--- a/tests/auto/parser/tst_parser.cpp
+++ b/tests/auto/parser/tst_parser.cpp
@@ -29,7 +29,7 @@
#include <QtTest>
#include <QObject>
#include <QXmlStreamReader>
-#include <QtScxml/qscxmlparser.h>
+#include <QtScxml/qscxmlcompiler.h>
#include <QtScxml/qscxmlstatemachine.h>
Q_DECLARE_METATYPE(QScxmlError);
diff --git a/tests/auto/scion/tst_scion.cpp b/tests/auto/scion/tst_scion.cpp
index 1adf0b7..a068005 100644
--- a/tests/auto/scion/tst_scion.cpp
+++ b/tests/auto/scion/tst_scion.cpp
@@ -30,7 +30,7 @@
#include <QCoreApplication>
#include <QJsonDocument>
-#include <QtScxml/qscxmlparser.h>
+#include <QtScxml/qscxmlcompiler.h>
#include <QtScxml/qscxmlecmascriptdatamodel.h>
#include <functional>
@@ -86,7 +86,7 @@ public:
}
};
-class DynamicLoader: public QScxmlParser::Loader
+class DynamicLoader: public QScxmlCompiler::Loader
{
public:
DynamicLoader();
@@ -201,12 +201,12 @@ void TestScion::dynamic()
QFile scxmlFile(QLatin1String(":/") + scxml);
QVERIFY(scxmlFile.open(QIODevice::ReadOnly));
QXmlStreamReader xmlReader(&scxmlFile);
- QScxmlParser parser(&xmlReader);
- parser.setFileName(scxml);
+ QScxmlCompiler compiler(&xmlReader);
+ compiler.setFileName(scxml);
DynamicLoader loader;
- parser.setLoader(&loader);
- QScopedPointer<QScxmlStateMachine> stateMachine(parser.parse());
- QVERIFY(parser.errors().isEmpty());
+ compiler.setLoader(&loader);
+ QScopedPointer<QScxmlStateMachine> stateMachine(compiler.compile());
+ QVERIFY(compiler.errors().isEmpty());
scxmlFile.close();
QVERIFY(stateMachine != Q_NULLPTR);
diff --git a/tests/auto/statemachine/tst_statemachine.cpp b/tests/auto/statemachine/tst_statemachine.cpp
index 9c757e7..f09ad42 100644
--- a/tests/auto/statemachine/tst_statemachine.cpp
+++ b/tests/auto/statemachine/tst_statemachine.cpp
@@ -29,7 +29,7 @@
#include <QtTest>
#include <QObject>
#include <QXmlStreamReader>
-#include <QtScxml/qscxmlparser.h>
+#include <QtScxml/qscxmlcompiler.h>
#include <QtScxml/qscxmlstatemachine.h>
#include <QtScxml/private/qscxmlstatemachine_p.h>
diff --git a/tools/qscxmlc/qscxmlc.cpp b/tools/qscxmlc/qscxmlc.cpp
index 03edf5c..de97a18 100644
--- a/tools/qscxmlc/qscxmlc.cpp
+++ b/tools/qscxmlc/qscxmlc.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include <QtScxml/private/qscxmlparser_p.h>
+#include <QtScxml/private/qscxmlcompiler_p.h>
#include <QtScxml/qscxmltabledata.h>
#include "scxmlcppdumper.h"
#include "qscxmlc.h"
@@ -174,21 +174,21 @@ int run(const QStringList &arguments)
}
QXmlStreamReader reader(&file);
- QScxmlParser parser(&reader);
- parser.setFileName(file.fileName());
- parser.parse();
- if (!parser.errors().isEmpty()) {
- const auto errors = parser.errors();
+ QScxmlCompiler compiler(&reader);
+ compiler.setFileName(file.fileName());
+ compiler.compile();
+ if (!compiler.errors().isEmpty()) {
+ const auto errors = compiler.errors();
for (const QScxmlError &error : errors) {
errs << error.toString() << endl;
}
return ParseError;
}
- auto mainDoc = QScxmlParserPrivate::get(&parser)->scxmlDocument();
+ auto mainDoc = QScxmlCompilerPrivate::get(&compiler)->scxmlDocument();
if (mainDoc == nullptr) {
- Q_ASSERT(!parser.errors().isEmpty());
- const auto errors = parser.errors();
+ Q_ASSERT(!compiler.errors().isEmpty());
+ const auto errors = compiler.errors();
for (const QScxmlError &error : errors) {
errs << error.toString() << endl;
}
diff --git a/tools/qscxmlc/qscxmlc.pri b/tools/qscxmlc/qscxmlc.pri
index 17afe4b..4c7c991 100644
--- a/tools/qscxmlc/qscxmlc.pri
+++ b/tools/qscxmlc/qscxmlc.pri
@@ -14,8 +14,8 @@ HEADERS += \
$$PWD/scxmlcppdumper.h
HEADERS += \
- $$PWD/../../src/scxml/qscxmlparser.h \
- $$PWD/../../src/scxml/qscxmlparser_p.h \
+ $$PWD/../../src/scxml/qscxmlcompiler.h \
+ $$PWD/../../src/scxml/qscxmlcompiler_p.h \
$$PWD/../../src/scxml/qscxmlglobals.h \
$$PWD/../../src/scxml/qscxmlexecutablecontent.h \
$$PWD/../../src/scxml/qscxmlexecutablecontent_p.h \
@@ -23,7 +23,7 @@ HEADERS += \
$$PWD/../../src/scxml/qscxmltabledata.h
SOURCES += \
- $$PWD/../../src/scxml/qscxmlparser.cpp \
+ $$PWD/../../src/scxml/qscxmlcompiler.cpp \
$$PWD/../../src/scxml/qscxmlexecutablecontent.cpp \
$$PWD/../../src/scxml/qscxmlerror.cpp \
$$PWD/../../src/scxml/qscxmltabledata.cpp
diff --git a/tools/qscxmlc/scxmlcppdumper.h b/tools/qscxmlc/scxmlcppdumper.h
index e1abfc2..2d6b12c 100644
--- a/tools/qscxmlc/scxmlcppdumper.h
+++ b/tools/qscxmlc/scxmlcppdumper.h
@@ -31,7 +31,7 @@
#include "qscxmlglobals.h"
-#include <QtScxml/private/qscxmlparser_p.h>
+#include <QtScxml/private/qscxmlcompiler_p.h>
#include <QtScxml/private/qscxmltabledata_p.h>
#include <QTextStream>