Add command syntax highlighting.
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
|
||||
namespace bed::internal::io {
|
||||
struct Token {
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
uint64_t start;
|
||||
uint64_t end;
|
||||
enum Kind : uint8_t {
|
||||
TempCurrent,
|
||||
BufferName,
|
||||
@@ -24,7 +24,6 @@ struct Token {
|
||||
Shell,
|
||||
Ruby,
|
||||
File,
|
||||
Regex,
|
||||
Replacement,
|
||||
Suffix,
|
||||
Color1,
|
||||
|
||||
@@ -85,12 +85,12 @@ struct Parser {
|
||||
std::string_view cmd;
|
||||
uint16_t i;
|
||||
Command *command;
|
||||
std::vector<ui::Token> *tokens;
|
||||
std::vector<io::Token> *tokens;
|
||||
CompletionContext *completion;
|
||||
|
||||
explicit Parser(
|
||||
std::string_view cmd, BEd &bed, Command *command,
|
||||
std::vector<ui::Token> *tokens, CompletionContext *completion
|
||||
std::vector<io::Token> *tokens, CompletionContext *completion
|
||||
);
|
||||
|
||||
char peek(uint16_t = 0); // == \0 if at eof.
|
||||
@@ -107,7 +107,7 @@ struct Parser {
|
||||
void operation();
|
||||
|
||||
void parse();
|
||||
|
||||
static std::vector<io::Token> get_highlight(std::string_view cmd, BEd &bed);
|
||||
static Command get_command(std::string_view, BEd &);
|
||||
static std::vector<AddressPromise> get_addresses(std::string_view cmd, BEd &bed);
|
||||
};
|
||||
|
||||
@@ -4,31 +4,6 @@
|
||||
#include "pch.h"
|
||||
|
||||
namespace bed::internal::ui {
|
||||
struct Token {
|
||||
enum struct Type : uint8_t {
|
||||
TempCurrent, // @
|
||||
AddressSeperator, // ; ,
|
||||
Address, // . $ % [ ] ^ ~
|
||||
Offset, // +N -N + -
|
||||
AddressRegex, // /re/ ?re?
|
||||
AddressSymbol, // >s> <s< <s>
|
||||
Number, // 10
|
||||
Mark, // 'm
|
||||
RubyFunction, // (func:arg)
|
||||
RubyArg,
|
||||
Function,
|
||||
Any,
|
||||
Shell,
|
||||
Ruby,
|
||||
File,
|
||||
Regex,
|
||||
Replacement,
|
||||
Suffix
|
||||
} type;
|
||||
uint16_t start;
|
||||
uint16_t end;
|
||||
};
|
||||
|
||||
struct CommandIO {
|
||||
std::string cmd;
|
||||
uint16_t cursor;
|
||||
|
||||
Reference in New Issue
Block a user