1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

regex: bug fixes, improved tests

This commit is contained in:
penguindark
2020-12-08 19:38:25 +01:00
committed by GitHub
parent a1c0bb3585
commit 2bc1076921
2 changed files with 66 additions and 21 deletions

View File

@ -1814,6 +1814,12 @@ pub fn (mut re RE) match_base(in_txt byteptr, in_txt_len int ) (int,int) {
re.groups[g_index] = 0
}
re.groups[g_index+1] = i
// if a group end with a dot, manage the not increased char index
if i == re.groups[g_index] {
re.groups[g_index+1] = i+1
}
//println("GROUP ${re.prog[pc].group_id} END [${re.groups[g_index]}, ${re.groups[g_index+1]}]")
// continuous save, save until we have space
@ -2092,6 +2098,13 @@ pub fn (mut re RE) match_base(in_txt byteptr, in_txt_len int ) (int,int) {
re.prog[tmp_pc].group_rep = 0 // clear the repetitions
group_index--
m_state = .ist_next
// if dot char manage advance of the group
if l_ist == u32(ist_dot_char) {
//print("dot char next char")
i+=char_len
}
continue
}
else if rep >= re.prog[tmp_pc].rep_min {