The @@@klammerset system command formally declares a klammerset — a named, logically related group of klammer definitions — with an operative, idempotent declaration (:requires and :files load in order at the declaration point, relative to the declaring file). A bare symbol given to ktext -k, kdesc --input, or :requires resolves to x/x.k on the search path: the document's directory, then KLAMMERTEXT_KLAMMERSETS, then KLAMMERTEXT_HOME; kdesc --klammerset lists the available sets. sks/sks.k is the first declared klammerset, so `-k sks` loads the SKS by name. The engine's lookup classes were renamed *_set → *_registry to keep the two concepts apart, and the whole C++ tree now follows standard const-correctness conventions. tst/ gains klammerset_test.sh (18 cases). (from dev 64b1abf23e56)
39 lines
982 B
C++
39 lines
982 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "machine.h"
|
|
#include "katom.h"
|
|
|
|
enum class eval_t {
|
|
shell,
|
|
python,
|
|
cpp,
|
|
};
|
|
|
|
class Eval
|
|
{
|
|
public:
|
|
explicit Eval(Machine& machine, const Locator& loc)
|
|
: m_machine(machine),
|
|
m_loc(loc)
|
|
{};
|
|
Eval(const Eval&) = delete;
|
|
Eval& operator=(const Eval&) = delete;
|
|
//~Eval_cpp();
|
|
|
|
std::vector<Katom> eval(
|
|
std::vector<Katom>::iterator begin, std::vector<Katom>::iterator end);
|
|
|
|
// Dispatch the @eval command (python/shell/haskell/cpp) and return its
|
|
// raw string result, without re-reading it as Klammertext. Used by
|
|
// :after_apply phase functions, whose input and output are final target
|
|
// text -- re-katomizing it would misparse target characters (a "@" in
|
|
// justified txt output) as Klammertext syntax.
|
|
std::string eval_command(
|
|
std::vector<Katom>::iterator begin, std::vector<Katom>::iterator end);
|
|
|
|
Machine m_machine;
|
|
Locator m_loc;
|
|
};
|