XPlor/libs/dsl/dslengine.h

34 lines
892 B
C
Raw Normal View History

2026-01-01 22:18:25 -05:00
#ifndef DSLENGINE_H
#define DSLENGINE_H
#include "interpreter.h"
struct MatchResult {
bool ok = false;
QString typeName;
QString error; // parse/criteria error
QString failReason;// require returned false
};
class DslEngine {
public:
DslEngine() = default;
// Compile script text into a module
Module compile(const QString& scriptText);
// Compile + run a type on a QIODevice
QVariantMap parse(const QString& scriptText, const QString& typeName, QIODevice* dev);
// Reuse compiled module
QVariantMap parse(const Module& mod, const QString& typeName, QIODevice* dev);
MatchResult matchType(QIODevice& dev, const QString& typeName) const;
MatchResult matchAny(QIODevice& dev, const QStringList& candidates) const;
bool parseType(QIODevice& dev, const QString& typeName, QVariantMap& outTree) const;
};
#endif // DSLENGINE_H