Initial commit: Klammertext source distribution

Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-18 18:48:23 +02:00
commit 2ba7ceee7a
272 changed files with 27634 additions and 0 deletions

51
mac/argtype.h Normal file
View File

@@ -0,0 +1,51 @@
#pragma once
#include <string>
#include <variant>
#include <functional>
#include <regex>
#include "locator.h"
using argtype_t = std::variant<bool,double,std::string,std::vector<std::string>>;
using modify_string_f = std::function<std::string(std::vector<std::string>)>;
class Argtype
{
public:
Argtype()
: m_name("default")
, m_desc("default argument type")
, m_symbolic_pattern(".+")
, m_pattern(".+")
, m_python_cast("str")
, m_python_format()
, m_loc()
{};
Argtype(std::string name, std::string desc, std::string symbolic_pattern, std::string pattern,
std::string python_cast, modify_string_f python_format,
const Locator& loc);
std::string python_value(const std::string& var_name, std::vector<std::string> value, size_t name_size);
std::string m_name {};
std::string m_desc {};
std::string m_symbolic_pattern {};
std::string m_pattern {};
std::string m_python_cast {};
modify_string_f m_python_format {};
std::regex m_regex {};
int m_count {1};
int m_mincount {1};
int m_maxcount {1};
Locator m_loc;
};
std::string pyformat_string(const std::vector<std::string>& value);
std::string pyformat_bool(const std::vector<std::string>& value);
std::string pyformat_number(const std::vector<std::string>& value);
std::string pyformat_list(const std::vector<std::string>& value);
std::string pyformat_dlist(const std::vector<std::string>& value);