Klammerset: the @@@klammerset construct, its search path, and const correctness
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)
This commit is contained in:
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
void update_width(Arg arg);
|
||||
|
||||
void check_flags_and_options(std::string command, std::vector<std::string>& words);
|
||||
void check_flags_and_options(const std::string& command, std::vector<std::string>& words);
|
||||
void parse_flags(std::vector<std::string>& words, std::map<std::string, std::string>& named_args);
|
||||
void parse_optional(std::vector<std::string>& words, std::map<std::string, std::string>& named_args);
|
||||
void parse_vars(std::vector<std::string>& words, std::map<std::string, std::string>& named_args);
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
bool given(const std::string& name) { return m_given.contains(name); };
|
||||
|
||||
void parse_positional(
|
||||
std::string command, // std::vector<std::string> words,
|
||||
const std::string& command, // std::vector<std::string> words,
|
||||
std::string pos_args, std::map<std::string, std::string>& named_args);
|
||||
|
||||
std::map<std::string, std::string> classify_arguments(int argc, char* argv[], bool full_parse=true);
|
||||
@@ -96,11 +96,11 @@ public:
|
||||
void describe();
|
||||
// void describe(Argv original);
|
||||
|
||||
bool is_flag(std::string name) {
|
||||
bool is_flag(const std::string& name) const {
|
||||
return std::ranges::count(m_flag_names, name) > 0;
|
||||
}
|
||||
|
||||
bool is_opt(std::string name) {
|
||||
bool is_opt(const std::string& name) const {
|
||||
return std::ranges::count(m_opt_names, name) > 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user