- Hand-written lexer + recursive-descent parser for .kap package definitions
- Package constructs: const, license, provides, outputs, patches, depends
(version-constrained, feature-gated, output-targeted), features (enabled/
forced/flag), config files (default/replace/merge with cfg interpolation),
env (?= soft-set), prepare/build/check/install phases
- Evaluator: recursive resolver for prefix, jobopts, destdir, userargs,
cfg.*, feature.*, package vars
- Comments: // single-line, /* */ multi-line
- /kappa/{bin,temp,db,system,system/builds} path layout
- Clang 22, C++23, CMake + vcpkg (tomlplusplus)
- .clangd + .clang-tidy configured
29 lines
756 B
C++
29 lines
756 B
C++
#include "kappa/package.hpp"
|
|
|
|
#include <toml++/toml.hpp>
|
|
#include <cstdlib>
|
|
#include <exception>
|
|
#include <filesystem>
|
|
#include <iostream>
|
|
|
|
int main(int argc, char* argv[]) {
|
|
std::filesystem::path toml_path = (argc > 1) ? argv[1] : "package.toml";
|
|
|
|
if (!std::filesystem::exists(toml_path)) {
|
|
std::cerr << "Error: '" << toml_path << "' not found\n";
|
|
return 1;
|
|
}
|
|
|
|
try {
|
|
auto pkg = kappa::parse_package(toml_path.native());
|
|
kappa::print_package(std::cout, pkg);
|
|
return 0;
|
|
} catch (const toml::parse_error& e) {
|
|
std::cerr << "Parse error:\n" << e << '\n';
|
|
return 1;
|
|
} catch (const std::exception& e) {
|
|
std::cerr << "Error: " << e.what() << '\n';
|
|
return 1;
|
|
}
|
|
}
|