Add source code.
This commit is contained in:
1 parent
dab19ace02
commit
0b8a7b3cdc
31 files changed
+2809
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#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
|
||||
Reference in new issue
Block a user