Improvements with regex system.

This commit is contained in:
2026-07-29 16:40:08 +01:00
parent b10f1291a0
commit 89b24a7488
6 changed files with 117 additions and 132 deletions
+4 -6
View File
@@ -4,20 +4,18 @@
#include "vase/shard.h"
struct RegexGroup {
uint32_t start;
uint32_t end;
bool matched;
uint32_t start{UINT32_MAX};
uint32_t end{UINT32_MAX};
};
struct RegexMatch {
uint32_t start;
uint32_t end;
std::vector<RegexGroup> groups{};
RegexGroup groups[9]{};
};
const std::vector<RegexMatch> regex_search(
std::vector<RegexMatch> regex_search(
Shard *root, std::string_view pattern_str,
uint32_t start_offset, uint32_t end_offset,
std::string_view options
);
void print_regex(const std::vector<RegexMatch> &matches);
+4 -4
View File
@@ -4,20 +4,20 @@
#include "pch.h"
struct Shard {
enum struct ShardKind {
enum struct ShardKind : uint8_t {
Branch,
Petal
} kind;
uint8_t height;
uint32_t length;
uint32_t lines;
uint8_t height;
std::atomic_uint32_t refs;
Shard(ShardKind kind, uint32_t length, uint32_t lines, uint8_t height)
: kind(kind), length(length), lines(lines), height(height), refs(1) {};
: kind(kind), height(height), length(length), lines(lines), refs(1) {};
virtual ~Shard() = default;