Filenames with spaces; output beside the input file; warning fixes (from dev c08eb1bbfa4c)

- Filenames may contain spaces: quote on the command line; filename
  lists use a standalone "/" separator; unseparated names that do not
  exist are rejoined into names that do (announced); leading ~ expands.
- Without -o, output is written to the input file's directory; -o fully
  specifies the output directory and basename.
- "Word not parsed" warnings now appear without -v, only for text that
  survives removal, with correct line numbers.
- New tst/filename_test.sh regression suite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 23:22:59 +02:00
parent d9c98ac86d
commit fd9a370af7
21 changed files with 430 additions and 34 deletions

View File

@@ -16,7 +16,7 @@ public:
Katom(const std::string& src, katom_t type, Locator loc);
// Copy constructor
Katom(const Katom& other)
Katom(const Katom& other)
: m_index(other.m_index)
, m_text(other.m_text)
, m_src(other.m_src)
@@ -24,6 +24,7 @@ public:
, m_type(other.m_type)
, m_initial_type(other.m_initial_type)
, m_display(other.m_display)
, m_unparsed(other.m_unparsed)
{}
// Copy assignment operator
@@ -36,6 +37,7 @@ public:
m_type = other.m_type;
m_initial_type = other.m_initial_type;
m_display = other.m_display;
m_unparsed = other.m_unparsed;
}
return *this;
}
@@ -68,6 +70,10 @@ public:
katom_t m_type;
katom_t m_initial_type;
std::string m_display {};
// Set when the word matched no katom type and fell back to katom_t::word.
// The warning is deferred to warn_unparsed_katoms(), after removal and
// literal marking, so removed text (comments, #[...]# blocks) never warns.
bool m_unparsed {};
};
bool active(const std::vector<Katom>& katoms);
@@ -97,6 +103,7 @@ std::vector<std::string> line_split(std::string s);
std::pair<std::string, std::vector<std::string>> line_split(fs::path pathname);
std::vector<Katom> katomize(const std::vector<std::string>& lines, const std::string& source_desc);
void warn_unparsed_katoms(std::vector<Katom>& katoms, bool warn = true);
void process_whitespace_modifiers(std::vector<Katom>& katoms);
std::vector<Katom> trim_whitespace(std::vector<Katom> katoms);