21 #include "scriptableparser.h" 25 #include <QtQml/QJSEngine> 27 ScriptableParser::ScriptableParser(
Cutelee::Parser *p, QJSEngine *engine)
28 :
QObject(engine), m_p(p), m_engine(engine)
34 bool ScriptableParser::hasNextToken()
const {
return m_p->
hasNextToken(); }
36 void ScriptableParser::loadLib(
const QString &name) { m_p->loadLib(name); }
38 QJSValue ScriptableParser::takeNextToken()
41 auto obj = m_engine->newObject();
42 obj.setProperty(QStringLiteral(
"tokenType"), t.
tokenType);
43 obj.setProperty(QStringLiteral(
"content"), t.
content);
47 void ScriptableParser::skipPast(
const QString &tag) { m_p->
skipPast(tag); }
60 auto nodeList = m_p->
parse(node, stopAt);
62 for (
auto n : nodeList) {
NodeList parse(Node *parent, const QStringList &stopAt={})
QString content
The content of this Token.
Base class for all nodes.
void skipPast(const QString &tag)
The Parser class processes a string template into a tree of nodes.
int tokenType
The Type of this Token.
T qobject_cast(QObject *object)
QObject * parent() const const
bool hasNextToken() const