Files
LLS/include/Tokenizer.h
T
2026-10-17 03:29:11 -03:00

23 lines
735 B
C++

#pragma once
#include <cstddef>
#include <string>
#include <vector>
namespace Tokenizer {
// Splits a command line on whitespace. Double quotes group words into a single
// token ("Breeze A"). Throws std::invalid_argument on an unterminated quote.
std::vector<std::string> split(const std::string& line);
// Lenient split for tab completion: completed words, plus the word being typed.
struct PartialLine {
std::vector<std::string> words; // completed words (quotes removed)
std::string current; // word being typed (quotes removed, may be empty)
std::size_t start = 0; // index in the text where that word begins
};
PartialLine splitPartial(const std::string& text);
} // namespace Tokenizer