mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
Remove printing facilities for Regular_Expression
The `original_pattern` introduced a tenuous dependency to the expression value as a whole, and after some consideration, I decided that it would be better for the developer to manage their own pattern strings. In the event you need to print the text representation of a pattern, it's usually better that you manage the memory of it as well.
This commit is contained in:
@@ -9,7 +9,6 @@ import "core:io"
|
||||
import "core:reflect"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
import "core:text/regex"
|
||||
import "core:time"
|
||||
import "core:unicode/utf8"
|
||||
|
||||
@@ -2406,21 +2405,6 @@ fmt_named :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Named)
|
||||
write_padded_number(fi, (ns), 9)
|
||||
io.write_string(fi.writer, " +0000 UTC", &fi.n)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ Capture :: struct {
|
||||
}
|
||||
|
||||
Regular_Expression :: struct {
|
||||
original_pattern: string,
|
||||
flags: Flags,
|
||||
class_data: []virtual_machine.Rune_Class_Data,
|
||||
program: []virtual_machine.Opcode `fmt:"-"`,
|
||||
@@ -92,7 +91,6 @@ create :: proc(
|
||||
// allocator so everything can be tightly packed.
|
||||
context.allocator = permanent_allocator
|
||||
|
||||
result.original_pattern = pattern
|
||||
result.flags = flags
|
||||
|
||||
if len(class_data) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user