Major updates:
- A lotta cleanup - BEd command parser rewrite - Vase class removed - Proper IO system. - A lot more.
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include "definitions.h"
|
||||
#include "internal/buffer/buffer.h"
|
||||
#include "internal/trie/trie.h"
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed::internal::functions {
|
||||
struct Function {
|
||||
struct GlobalArg {
|
||||
char delim;
|
||||
std::string str;
|
||||
};
|
||||
struct RegexArg {
|
||||
std::string expression;
|
||||
std::string replacement;
|
||||
std::string options;
|
||||
};
|
||||
struct ShellArg {
|
||||
std::string cmd;
|
||||
};
|
||||
struct RubyArg {
|
||||
std::string cmd;
|
||||
};
|
||||
using Argument = std::variant<
|
||||
std::monostate,
|
||||
GlobalArg,
|
||||
RegexArg,
|
||||
ShellArg,
|
||||
RubyArg,
|
||||
std::string,
|
||||
std::filesystem::path,
|
||||
int64_t,
|
||||
char,
|
||||
buffer::Range,
|
||||
buffer::Line>;
|
||||
|
||||
enum struct AddressKind {
|
||||
None,
|
||||
Line,
|
||||
Range
|
||||
} address_kind;
|
||||
|
||||
enum struct ArgumentKind {
|
||||
None,
|
||||
Regex,
|
||||
Shell,
|
||||
Ruby,
|
||||
Any,
|
||||
File,
|
||||
Number,
|
||||
Mark,
|
||||
Range,
|
||||
Line,
|
||||
Global
|
||||
} argument_kind;
|
||||
|
||||
enum struct InputMode {
|
||||
None,
|
||||
Text,
|
||||
Interactive,
|
||||
CommandList
|
||||
} input_mode;
|
||||
|
||||
std::string desc;
|
||||
std::string default_address;
|
||||
bool accept_zero;
|
||||
|
||||
std::function<
|
||||
std::tuple<vase::Shard *, syntax::Language *, void *>(
|
||||
BEd &ctx, const buffer::Address &addr, const Argument &arg
|
||||
)>
|
||||
pre_text_mode;
|
||||
|
||||
std::function<
|
||||
void(
|
||||
BEd &ctx, const buffer::Address &addr,
|
||||
vase::Shard *text, const Argument &arg,
|
||||
std::vector<buffer::Line> *marked
|
||||
)>
|
||||
handle;
|
||||
|
||||
static void register_posix(BEd &ctx);
|
||||
};
|
||||
} // namespace bed::internal::functions
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "definitions.h"
|
||||
#include "internal/buffer/buffer.h"
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed::internal::functions {
|
||||
struct Suffix {
|
||||
std::string desc;
|
||||
std::function<void(BEd &)> handle;
|
||||
|
||||
static void register_suffixes(BEd &ctx);
|
||||
};
|
||||
} // namespace bed::internal::functions
|
||||
Reference in New Issue
Block a user