aboutsummaryrefslogtreecommitdiff
path: root/core/encoding
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2022-08-11 16:14:27 +0100
committerGitHub <noreply@github.com>2022-08-11 16:14:27 +0100
commit57b20e634bf7bd9c606ceb3aec425beb4a1d0db8 (patch)
tree8633580c3cc47b360de210dd5faf35b4e9d6a011 /core/encoding
parent425dec8bb8cc4fe2cf25a008de199d3084ecb510 (diff)
parente285796fc11148c2f461a1d3753d28babd83769e (diff)
Merge branch 'master' into pretty-json-2
Diffstat (limited to 'core/encoding')
-rw-r--r--core/encoding/entity/entity.odin8
-rw-r--r--core/encoding/entity/example/entity_example.odin2
-rw-r--r--core/encoding/hxa/hxa.odin2
-rw-r--r--core/encoding/json/marshal.odin5
-rw-r--r--core/encoding/json/unmarshal.odin4
-rw-r--r--core/encoding/xml/example/xml_example.odin2
6 files changed, 13 insertions, 10 deletions
diff --git a/core/encoding/entity/entity.odin b/core/encoding/entity/entity.odin
index e5831a75f..694fcdffc 100644
--- a/core/encoding/entity/entity.odin
+++ b/core/encoding/entity/entity.odin
@@ -25,8 +25,8 @@ import "core:strings"
MAX_RUNE_CODEPOINT :: int(unicode.MAX_RUNE)
-write_rune :: strings.write_rune_builder
-write_string :: strings.write_string_builder
+write_rune :: strings.write_rune
+write_string :: strings.write_string
Error :: enum u8 {
None = 0,
@@ -94,8 +94,8 @@ decode_xml :: proc(input: string, options := XML_Decode_Options{}, allocator :=
l := len(input)
if l == 0 { return "", .None }
- builder := strings.make_builder()
- defer strings.destroy_builder(&builder)
+ builder := strings.builder_make()
+ defer strings.builder_destroy(&builder)
t := Tokenizer{src=input}
in_data := false
diff --git a/core/encoding/entity/example/entity_example.odin b/core/encoding/entity/example/entity_example.odin
index 6fc377f9d..6301eb263 100644
--- a/core/encoding/entity/example/entity_example.odin
+++ b/core/encoding/entity/example/entity_example.odin
@@ -8,7 +8,7 @@ import "core:time"
doc_print :: proc(doc: ^xml.Document) {
buf: strings.Builder
- defer strings.destroy_builder(&buf)
+ defer strings.builder_destroy(&buf)
w := strings.to_writer(&buf)
xml.print(w, doc)
diff --git a/core/encoding/hxa/hxa.odin b/core/encoding/hxa/hxa.odin
index f47661bad..9b24ede9c 100644
--- a/core/encoding/hxa/hxa.odin
+++ b/core/encoding/hxa/hxa.odin
@@ -107,7 +107,7 @@ Node :: struct {
/* Conventions */
/* ------------
Much of HxA's use is based on convention. HxA lets users store arbitrary data in its structure that can be parsed but whose semantic meaning does not need to be understood.
-A few conventions are hard, and some are soft. Hard convention that a user HAS to follow in order to produce a valid file. Hard conventions simplify parsing becaus the parser can make some assumptions. Soft convenbtions are basicly recomendations of how to store common data.
+A few conventions are hard, and some are soft. Hard convention that a user HAS to follow in order to produce a valid file. Hard conventions simplify parsing becaus the parser can make some assumptions. Soft convenbtions are basically recomendations of how to store common data.
If you use HxA for something not covered by the conventions but need a convention for your use case. Please let us know so that we can add it!
*/
diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin
index 2a92cec28..9dbe31cb6 100644
--- a/core/encoding/json/marshal.odin
+++ b/core/encoding/json/marshal.odin
@@ -44,7 +44,7 @@ Marshal_Options :: struct {
mjson_skipped_first_braces_end: bool,
}
-marshal :: proc(v: any, opt: Marshal_Options = {}, allocator := context.allocator) -> (data: []byte, err: Marshal_Error) {
+marshal :: proc(v: any, opt := Marshal_Options{}, allocator := context.allocator) -> (data: []byte, err: Marshal_Error) {
b := strings.builder_make(allocator)
defer if err != nil {
strings.builder_destroy(&b)
@@ -192,6 +192,9 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
case runtime.Type_Info_Multi_Pointer:
return .Unsupported_Type
+ case runtime.Type_Info_Soa_Pointer:
+ return .Unsupported_Type
+
case runtime.Type_Info_Procedure:
return .Unsupported_Type
diff --git a/core/encoding/json/unmarshal.odin b/core/encoding/json/unmarshal.odin
index 2ff268a21..97d2421d4 100644
--- a/core/encoding/json/unmarshal.odin
+++ b/core/encoding/json/unmarshal.odin
@@ -325,7 +325,7 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
UNSUPPORTED_TYPE := Unsupported_Type_Error{v.id, p.curr_token}
if end_token == .Close_Brace {
- assert(expect_token(p, .Open_Brace) == nil)
+ unmarshal_expect_token(p, .Open_Brace)
}
v := v
@@ -473,7 +473,7 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
}
if end_token == .Close_Brace {
- assert(expect_token(p, .Close_Brace) == nil)
+ unmarshal_expect_token(p, .Close_Brace)
}
return
}
diff --git a/core/encoding/xml/example/xml_example.odin b/core/encoding/xml/example/xml_example.odin
index f7e74840e..887b40764 100644
--- a/core/encoding/xml/example/xml_example.odin
+++ b/core/encoding/xml/example/xml_example.odin
@@ -84,7 +84,7 @@ example :: proc() {
doc_hash :: proc(doc: ^xml.Document, print := false) -> (crc32: u32) {
buf: strings.Builder
- defer strings.destroy_builder(&buf)
+ defer strings.builder_destroy(&buf)
w := strings.to_writer(&buf)
xml.print(w, doc)