mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@ -3,7 +3,7 @@ module regex
|
||||
import strings
|
||||
|
||||
// compile_opt compile RE pattern string
|
||||
pub fn (mut re RE) compile_opt(pattern string) ? {
|
||||
pub fn (mut re RE) compile_opt(pattern string) ! {
|
||||
re_err, err_pos := re.impl_compile(pattern)
|
||||
|
||||
if re_err != compile_ok {
|
||||
@ -34,7 +34,7 @@ pub fn new() RE {
|
||||
}
|
||||
|
||||
// regex_opt create new RE object from RE pattern string
|
||||
pub fn regex_opt(pattern string) ?RE {
|
||||
pub fn regex_opt(pattern string) !RE {
|
||||
// init regex
|
||||
mut re := RE{}
|
||||
re.prog = []Token{len: pattern.len + 1} // max program length, can not be longer then the pattern
|
||||
@ -47,7 +47,7 @@ pub fn regex_opt(pattern string) ?RE {
|
||||
re.group_data = []int{len: re.group_max, init: -1}
|
||||
|
||||
// compile the pattern
|
||||
re.compile_opt(pattern)?
|
||||
re.compile_opt(pattern)!
|
||||
|
||||
return re
|
||||
}
|
||||
|
Reference in New Issue
Block a user