mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
{.Glboal} implicit in regex allocator.
This commit is contained in:
@@ -279,6 +279,8 @@ create_iterator :: proc(
|
|||||||
permanent_allocator := context.allocator,
|
permanent_allocator := context.allocator,
|
||||||
temporary_allocator := context.temp_allocator,
|
temporary_allocator := context.temp_allocator,
|
||||||
) -> (result: Match_Iterator, err: Error) {
|
) -> (result: Match_Iterator, err: Error) {
|
||||||
|
flags := flags
|
||||||
|
flags += {.Global} // We're iterating over a string, so the next match could start anywhere
|
||||||
|
|
||||||
result.haystack = str
|
result.haystack = str
|
||||||
result.regex = create(pattern, flags, permanent_allocator, temporary_allocator) or_return
|
result.regex = create(pattern, flags, permanent_allocator, temporary_allocator) or_return
|
||||||
|
|||||||
@@ -1102,7 +1102,7 @@ Iterator_Test :: struct {
|
|||||||
|
|
||||||
iterator_vectors := []Iterator_Test{
|
iterator_vectors := []Iterator_Test{
|
||||||
{
|
{
|
||||||
`xxab32ab52xx`, `(ab\d{1})`, {.Global},
|
`xxab32ab52xx`, `(ab\d{1})`, {}, // {.Global} implicitly added by the iterator
|
||||||
{
|
{
|
||||||
{pos = {{2, 5}, {2, 5}}, groups = {"ab3", "ab3"}},
|
{pos = {{2, 5}, {2, 5}}, groups = {"ab3", "ab3"}},
|
||||||
{pos = {{6, 9}, {6, 9}}, groups = {"ab5", "ab5"}},
|
{pos = {{6, 9}, {6, 9}}, groups = {"ab5", "ab5"}},
|
||||||
|
|||||||
Reference in New Issue
Block a user