#ifndef LIDL_AST_H #define LIDL_AST_H #include #include #include struct TypeExpr { enum Kind { Primitive, Array, Map, Optional, Named }; Kind kind = Primitive; QString name; // primitive name ("tstr","int",...) or custom type name QVector elements; // Array: [0]=elem, Map: [0]=key [1]=val, Optional: [0]=inner bool operator==(const TypeExpr& o) const { return kind == o.kind && name == o.name && elements == o.elements; } bool operator!=(const TypeExpr& o) const { return !(*this == o); } }; struct FieldDecl { QString name; TypeExpr type; bool optional = false; bool operator==(const FieldDecl& o) const { return name == o.name && type == o.type && optional == o.optional; } }; struct ParamDecl { QString name; TypeExpr type; bool operator==(const ParamDecl& o) const { return name == o.name && type == o.type; } }; struct MethodDecl { QString name; QVector params; TypeExpr returnType; // True when the impl returns LogosMap or LogosList (nlohmann::json). // The generator will emit nlohmann→Qt conversion code in the glue layer. bool jsonReturn = false; bool operator==(const MethodDecl& o) const { return name == o.name && params == o.params && returnType == o.returnType && jsonReturn == o.jsonReturn; } }; struct EventDecl { QString name; QVector params; bool operator==(const EventDecl& o) const { return name == o.name && params == o.params; } }; struct TypeDecl { QString name; QVector fields; bool operator==(const TypeDecl& o) const { return name == o.name && fields == o.fields; } }; struct ModuleDecl { QString name; QString version; QString description; QString category; QStringList depends; QVector types; QVector methods; QVector events; // True when the impl header declares a public // std::function emitEvent; // The generator will wire it to LogosProviderBase::emitEvent in the glue. bool hasEmitEvent = false; bool operator==(const ModuleDecl& o) const { return name == o.name && version == o.version && description == o.description && category == o.category && depends == o.depends && types == o.types && methods == o.methods && events == o.events && hasEmitEvent == o.hasEmitEvent; } }; #endif // LIDL_AST_H