mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-09-02 10:41:15 +00:00
* feat: cpp-generator consumes logos-lidl; delete embedded frontend The canonical LIDL frontend now lives in logos-lidl. cpp-generator links it and keeps only the C++/Qt-specific parts (impl-header parsing, the gen_client/ gen_cdylib backends, the Qt type-name mapping). - Delete the embedded lidl_lexer/parser/serializer/validator/ast. - Add experimental/lidl_compat.h: brings logos-lidl's std AST into the global scope the backends use (via `using`), a qs() std::string→QString helper, a QTextStream<<std::string overload, and name-compatible shims (lidlParse/ lidlSerialize/lidlValidate) so the emission code keeps compiling. - Re-point impl_header_parser, lidl_gen_client (+ Doxygen /// docs on the generated client methods), lidl_gen_cdylib, lidl_emit_common, and legacy/ main at lidl::ModuleDecl. - CMake: C++17 + find_package(logos-lidl) + link logos-lidl::logos_lidl. - bin.nix: distribute only the shared C++/Qt backend helpers (compat + impl_header_parser + emit_common) under share/lidl-frontend, not the frontend. - tests: drop the 4 frontend test files (covered by logos-lidl now); the backend tests link logos-lidl. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: pin logos-lidl to the C-ABI commit + lock it The logos-lidl input was declared in flake.nix but missing from flake.lock, so override chains that don't reach the nested input (the doctest harness building a scaffolded module) couldn't resolve it. Pin the branch rev and lock it so the component is self-contained. Re-point at master once logos-lidl lands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: re-point logos-lidl to merged master (#5) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
2.0 KiB
C++
58 lines
2.0 KiB
C++
#ifndef LIDL_COMPAT_H
|
|
#define LIDL_COMPAT_H
|
|
|
|
// Bridge the cpp-generator's Qt-flavored codegen backends onto the canonical
|
|
// logos-lidl frontend. The lexer / parser / AST / serializer / validator now
|
|
// live in logos-lidl (std-typed, language-neutral); this header brings those
|
|
// types into the global scope the backends use unqualified and adds thin
|
|
// Qt-friendly shims so the existing emission code (QTextStream) keeps
|
|
// compiling. The backends themselves (impl-header parsing, gen_client,
|
|
// gen_cdylib) stay here — they are the C++/Qt-specific parts.
|
|
|
|
#include "lidl/ast.hpp"
|
|
#include "lidl/parser.hpp"
|
|
#include "lidl/serializer.hpp"
|
|
#include "lidl/validator.hpp"
|
|
|
|
#include <QString>
|
|
#include <QTextStream>
|
|
#include <string>
|
|
|
|
// The canonical AST, in the global scope the generator backends reference it
|
|
// from (they predate the logos-lidl extraction and use the unqualified names).
|
|
using lidl::TypeExpr;
|
|
using lidl::FieldDecl;
|
|
using lidl::ParamDecl;
|
|
using lidl::MethodDecl;
|
|
using lidl::EventDecl;
|
|
using lidl::TypeDecl;
|
|
using lidl::ModuleDecl;
|
|
|
|
// std::string -> QString, and let QTextStream accept std::string directly so
|
|
// emission of AST string fields (`s << md.name`) keeps compiling unchanged.
|
|
inline QString qs(const std::string& s) { return QString::fromStdString(s); }
|
|
inline QTextStream& operator<<(QTextStream& s, const std::string& v)
|
|
{
|
|
return s << QString::fromStdString(v);
|
|
}
|
|
|
|
// Name-compatible shims over the canonical frontend so the call sites that used
|
|
// the deleted experimental lexer/parser/serializer/validator keep their shape.
|
|
using LidlParseResult = lidl::ParseResult;
|
|
using LidlValidationResult = lidl::ValidationResult;
|
|
|
|
inline lidl::ParseResult lidlParse(const QString& source)
|
|
{
|
|
return lidl::parse(source.toStdString());
|
|
}
|
|
inline QString lidlSerialize(const ModuleDecl& module)
|
|
{
|
|
return QString::fromStdString(lidl::serialize(module));
|
|
}
|
|
inline lidl::ValidationResult lidlValidate(const ModuleDecl& module)
|
|
{
|
|
return lidl::validate(module);
|
|
}
|
|
|
|
#endif // LIDL_COMPAT_H
|