summaryrefslogtreecommitdiff
path: root/src/regex_impl.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-01-03 22:52:15 +1100
committerMaxime Coste <mawww@kakoune.org>2019-01-03 22:55:50 +1100
commit328c497be248faf4e13aaececaf849c844c59efe (patch)
treeeb3d225fc81389afc8938593f065cf715804d75d /src/regex_impl.hh
parent56ee329d79d076742e60c10974c471cc8119ed05 (diff)
Add support for named captures to the regex impl and regex highlighter
ECMAScript is adding support for it, and it is a pretty isolated change to do. Fixes #2293
Diffstat (limited to 'src/regex_impl.hh')
-rw-r--r--src/regex_impl.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/regex_impl.hh b/src/regex_impl.hh
index 86d65ddd..86ae81a8 100644
--- a/src/regex_impl.hh
+++ b/src/regex_impl.hh
@@ -107,9 +107,16 @@ struct CompiledRegex : RefCountable, UseMemoryDomain<MemoryDomain::Regex>
explicit operator bool() const { return not instructions.empty(); }
+ struct NamedCapture
+ {
+ String name;
+ uint32_t index;
+ };
+
Vector<Instruction, MemoryDomain::Regex> instructions;
Vector<CharacterClass, MemoryDomain::Regex> character_classes;
Vector<Lookaround, MemoryDomain::Regex> lookarounds;
+ Vector<NamedCapture, MemoryDomain::Regex> named_captures;
uint32_t first_backward_inst; // -1 if no backward support, 0 if only backward, >0 if both forward and backward
uint32_t save_count;