mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
regex: align query/regex err pos in optional err messages/panics
This commit is contained in:
parent
02ba923ba7
commit
d0a2992335
@ -7,11 +7,11 @@ pub fn (mut re RE) compile_opt(pattern string) ? {
|
||||
|
||||
if re_err != compile_ok {
|
||||
mut err_msg := strings.new_builder(300)
|
||||
err_msg.write("query: $pattern\n")
|
||||
line := "-".repeat(err_pos)
|
||||
err_msg.write("err : ${line}^\n")
|
||||
err_str := re.get_parse_error_string(re_err)
|
||||
err_msg.write("ERROR: $err_str\n")
|
||||
err_msg.write("$err_str\n")
|
||||
err_msg.write(" query: $pattern\n")
|
||||
line := "-".repeat(err_pos)
|
||||
err_msg.write(" err pos: ${line}^")
|
||||
return error_with_code(err_msg.str(), re_err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user