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

regex: added default support for long queries (#12635)

This commit is contained in:
penguindark
2021-12-01 07:38:50 +01:00
committed by GitHub
parent f86710dcc7
commit 519ca90cfa
3 changed files with 48 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ pub fn regex_opt(pattern string) ?RE {
re.prog = []Token{len: pattern.len + 1} // max program length, can not be longer then the pattern
re.cc = []CharClass{len: pattern.len} // can not be more char class the the length of the pattern
re.group_csave_flag = false // enable continuos group saving
re.group_max_nested = 128 // set max 128 group nested
re.group_max_nested = pattern.len >> 1 // set max 128 group nested
re.group_max = pattern.len >> 1 // we can't have more groups than the half of the pattern legth
re.group_stack = []int{len: re.group_max, init: -1}