mirror of
https://github.com/odin-lang/Odin.git
synced 2026-09-17 17:24:43 +00:00
Merge pull request #6113 from StudebakerGuy/xmlcomment
core:encoding/xml comments not handled correctly before first element and include --
This commit is contained in:
@@ -264,7 +264,7 @@ scan_comment :: proc(t: ^Tokenizer) -> (comment: string, err: Error) {
|
||||
expect(t, .Dash)
|
||||
expect(t, .Gt)
|
||||
|
||||
return string(t.src[offset : t.offset - 1]), .None
|
||||
return string(t.src[offset : t.offset - 3]), .None
|
||||
}
|
||||
|
||||
// Skip CDATA
|
||||
|
||||
@@ -294,7 +294,7 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
|
||||
comment := scan_comment(t) or_return
|
||||
|
||||
if .Intern_Comments in opts.flags {
|
||||
if len(doc.elements) == 0 {
|
||||
if doc.element_count == 0 {
|
||||
append(&doc.comments, comment)
|
||||
} else {
|
||||
el := new_element(doc)
|
||||
|
||||
@@ -114,7 +114,7 @@ xml_test_entities :: proc(t: ^testing.T) {
|
||||
},
|
||||
expected_doctype = "html",
|
||||
},
|
||||
crc32 = 0x48f41216,
|
||||
crc32 = 0x98791215,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ xml_test_entities_unbox :: proc(t: ^testing.T) {
|
||||
},
|
||||
expected_doctype = "html",
|
||||
},
|
||||
crc32 = 0xd0567818,
|
||||
crc32 = 0x5fd5ab4e,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ xml_test_entities_unbox_decode :: proc(t: ^testing.T) {
|
||||
},
|
||||
expected_doctype = "html",
|
||||
},
|
||||
crc32 = 0x6e45a697,
|
||||
crc32 = 0xda1ac384,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -298,4 +298,4 @@ doc_to_string :: proc(doc: ^xml.Document) -> (result: string) {
|
||||
|
||||
print(strings.to_writer(&buf), doc)
|
||||
return strings.clone(strings.to_string(buf))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user