Skip to content

Commit

Permalink
examples: fix v -N examples/regex/regex_example.v
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed May 1, 2024
1 parent 91bef02 commit a097e54
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions examples/regex/regex_example.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ fn convert_html_rgb(in_col string) u32 {
mut res := u32(0)
if start >= 0 {
group_list := re.get_group_list()
r := ('0x' + in_col[group_list[0].start..group_list[0].end]).int() << col_mul
g := ('0x' + in_col[group_list[1].start..group_list[1].end]).int() << col_mul
b := ('0x' + in_col[group_list[2].start..group_list[2].end]).int() << col_mul
r := ('0x' + in_col[group_list[0].start..group_list[0].end]).u32() << col_mul
g := ('0x' + in_col[group_list[1].start..group_list[1].end]).u32() << col_mul
b := ('0x' + in_col[group_list[2].start..group_list[2].end]).u32() << col_mul
println('r: ${r} g: ${g} b: ${b}')
res = u32(r) << 16 | u32(g) << 8 | u32(b)
res = r << 16 | g << 8 | b
}
return res
}
Expand All @@ -55,16 +55,16 @@ fn convert_html_rgb_n(in_col string) u32 {
mut res := u32(0)
if start >= 0 {
red_s, red_e := re.get_group_bounds_by_name('red')
r := ('0x' + in_col[red_s..red_e]).int() << col_mul
r := ('0x' + in_col[red_s..red_e]).u32() << col_mul

green_s, green_e := re.get_group_bounds_by_name('green')
g := ('0x' + in_col[green_s..green_e]).int() << col_mul
g := ('0x' + in_col[green_s..green_e]).u32() << col_mul

blue_s, blue_e := re.get_group_bounds_by_name('blue')
b := ('0x' + in_col[blue_s..blue_e]).int() << col_mul
b := ('0x' + in_col[blue_s..blue_e]).u32() << col_mul

println('r: ${r} g: ${g} b: ${b}')
res = u32(r) << 16 | u32(g) << 8 | u32(b)
res = r << 16 | g << 8 | b
}
return res
}
Expand Down

0 comments on commit a097e54

Please sign in to comment.