mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Support printing Regular_Expression in fmt
This commit is contained in:
@@ -9,6 +9,7 @@ import "core:io"
|
|||||||
import "core:reflect"
|
import "core:reflect"
|
||||||
import "core:strconv"
|
import "core:strconv"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
|
import "core:text/regex"
|
||||||
import "core:time"
|
import "core:time"
|
||||||
import "core:unicode/utf8"
|
import "core:unicode/utf8"
|
||||||
|
|
||||||
@@ -2405,6 +2406,21 @@ fmt_named :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Named)
|
|||||||
write_padded_number(fi, (ns), 9)
|
write_padded_number(fi, (ns), 9)
|
||||||
io.write_string(fi.writer, " +0000 UTC", &fi.n)
|
io.write_string(fi.writer, " +0000 UTC", &fi.n)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
case regex.Regular_Expression:
|
||||||
|
io.write_byte(fi.writer, '/')
|
||||||
|
for r in a.original_pattern {
|
||||||
|
if r == '/' {
|
||||||
|
io.write_string(fi.writer, `\/`)
|
||||||
|
} else {
|
||||||
|
io.write_rune(fi.writer, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
io.write_byte(fi.writer, '/')
|
||||||
|
for flag in a.flags {
|
||||||
|
io.write_byte(fi.writer, regex.Flag_To_Letter[flag])
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user