Files
klammertext/mac/ktype.cpp
T
ackandClaude Fable 5.1 217c0f3fc5 katom types from ref/ in groups, @table :leading in lines of text and :rulesep, @code under txt, one table style attribute, literal-klammer options (from dev 2e453744f5e9)
kdesc --katoms is Klammertext rendered from ref/, the types in titled groups,
with --katoms full for the regex column.  @table :leading L is L lines of the
surrounding text in html as in pdf (default 1), and :rulesep spaces the
horizontal rules.  The html table has one style attribute, so :column_width
fractions take effect again.  @code and @source_listing render in plain
text; captions are numbered per kind there, and a table needs no blank line
around it.  @c takes :nd, and an option-shaped word before a bar inside
literal code is code.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 22:37:13 +02:00

65 lines
1.5 KiB
C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <stdexcept>
#include "locator.h"
#include "ktype.h"
#include "log.h"
#include "file.h"
#include "show.h"
#include "util.h"
/*
bool is_error(katom_t t)
{
return
t == katom_t::undefined ||
t == katom_t::no_matching_end ||
t == katom_t::no_matching_begin ||
t == katom_t::karg_error ||
t == katom_t::klammer_definition_type_error ||
t == katom_t::eval_error;
}
*/
bool is_active(katom_t type)
{
return type != katom_t::ignored
&& type != katom_t::replaced;
}
bool is_printable(katom_t type)
{
return printable_katom_types.find(type) != printable_katom_types.end();
}
bool is_deftype(katom_t type)
{
return
type == katom_t::klammer_definition ||
type == katom_t::klammer_instance ||
type == katom_t::klammer_override ||
type == katom_t::klammer_default;
}
const Ktype& type_to_katom_instance(katom_t type)
{
auto var = std::find_if(katom_types.begin(), katom_types.end(),
[&] (const Ktype& t) { return t.m_type == type; });
if (var == katom_types.end()) {
throw std::logic_error(
"type_to_katom_instance: katom type " +
std::to_string(static_cast<int>(type)) +
" has no entry in katom_types. See file mac/ktype.h.");
}
return *var;
}
std::string type_to_name(katom_t type)
{
return type_to_katom_instance(type).m_name;
}