Implement syntax highlighting

- Create a generic incremental syntax highlighting system.
- Implement a ruby syntax highlighter for it.
This commit is contained in:
2026-08-20 02:23:11 +01:00
parent 48fb8e3501
commit 3a41af01f9
18 changed files with 2631 additions and 28 deletions
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include "definitions.h"
#include "internal/syntax/parser.h"
#include "pch.h"
namespace bed::internal::theme {
struct Highlight {
enum : uint8_t {
None = 0,
Bold = 1 << 0,
Italic = 1 << 1,
Strikethrough = 1 << 2,
Underline = 1 << 3,
};
uint32_t fg;
uint32_t bg;
uint8_t flags;
};
struct Theme {
std::array<Highlight, internal::syntax::Token::Count> hl;
Theme();
Highlight get(internal::syntax::Token token) const;
static Theme default_theme();
static Theme from_name(std::string_view name);
};
} // namespace bed::internal::theme