Commit Graph

112 Commits

Author SHA1 Message Date
gingerBill
98b539ac5c Merge pull request #2912 from karl-zylinski/marshal-sort-maps-by-key-and-clone-value
JSON: Option to sort marshaled maps before outputting + clone_value proc + small improvements
2024-01-22 14:05:15 +00:00
Karl Zylinski
9d067ae562 Made sure temp guard for sorting map keys in json marshal code ignores temp allocator 2024-01-22 14:35:05 +01:00
gingerBill
0b83e3dae5 Enforce naming the parameters with builtin.quaternion to reduce confusion 2024-01-05 14:29:14 +00:00
Laytan Laats
8c10f4cdde encoding/json: try to unmarshal into union variants 2024-01-03 19:02:30 +01:00
Karl Zylinski
75cb2c68cc Cleanup of json.clone_value 2023-11-01 00:57:27 +01:00
Karl Zylinski
942e91f94c Added temp allocator guard to json.marshal, in case we temp alloc when sorting map kesy 2023-11-01 00:46:01 +01:00
Karl Zylinski
d8f06ed557 Reversed order of sort_maps_by_key check in marshal.odin to make PR comparison clearer. 2023-11-01 00:37:27 +01:00
Karl Zylinski
a73ff00b02 Indentation fix. 2023-11-01 00:33:59 +01:00
Karl Zylinski
a58a08c0c3 JSON: Option to sort marshaled maps before outputting. Also added a json.clone_value proc 2023-11-01 00:23:17 +01:00
Rickard Andersson
931e0d4687 cleanup: remove unused import 2023-10-02 15:21:09 +03:00
Rickard Andersson
cfa3765d50 fix: guard against empty key value in parse_object_body 2023-10-02 15:10:12 +03:00
Rickard Andersson
11e884aec5 docs: add note about checking for alloc error 2023-10-02 12:20:18 +03:00
Rickard Andersson
55a1ba710b fix: use runtime.map_insert to not overallocate 2023-10-02 11:59:37 +03:00
Rickard Andersson
0a8b266c71 fix(json): return .Out_Of_Memory when out of memory on parse
Previously this would silently simply not do anything and the object
would be empty/incomplete when parsed instead.
2023-10-02 11:50:16 +03:00
gingerBill
14adcb9db8 Use or_break and or_continue where appropriate in the core library 2023-09-30 15:34:39 +01:00
Abdelrahman Farid
f1872f495a Fix bug with index increment in unquote_string 2023-09-19 22:19:05 +03:00
RLGingerBiscuit
187a475b84 json.marshal: Don't output spaces if pretty=false 2023-08-25 17:33:41 +01:00
gingerBill
c91898a888 Remove #relative slices; Replace with #relative multi-pointers 2023-08-05 16:05:39 +01:00
gingerBill
3dec55f009 Replace x in &y Use &v in y syntax through core & vendor for switch/for statements 2023-06-26 15:42:57 +01:00
Laytan Laats
5d54b710e7 fix #2550 json encoding should use surrogate pairs per RFC7159 2023-05-22 17:22:33 +02:00
Ikko Eltociear Ashimine
47be46ae60 Fix typo in marshal.odin
seperation -> separation
2023-04-27 00:03:36 +09:00
jakubtomsu
a6d5f9877f Convert indentation to tabs 2023-04-14 17:27:52 +02:00
jakubtomsu
994825671d Handle unmarshalling to json.Value 2023-04-14 15:05:25 +02:00
Karl Zylinski
d7cc166eab Fix for skip_alphanum in JSON tokenizer not checking if first character is non-alphanum. This broke any single-character key when using SJSON specification in combination with not using quoted strings. 2023-04-05 22:37:05 +02:00
Jeroen van Rijn
1e4a4181e2 Typo 2023-03-25 07:37:43 +01:00
Jeroen van Rijn
4c13dee18f Update types.odin
Use `context.allocator := allocator` idiom.
2023-03-25 07:33:34 +01:00
Igor Dreher
95497626e3 Add allocator parameter to json.detroy_value 2023-03-24 21:01:23 -03:00
gingerBill
986cba584e Add runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD where appropriate 2023-02-10 16:23:33 +00:00
gingerBill
6179d4feb1 Rename to Type_Info_Parameters 2023-02-08 11:23:21 +00:00
gingerBill
450a602230 Fix json.marshal for map[string]string 2023-01-24 12:05:43 +00:00
gingerBill
04a1e7d638 Correct json/unmarshal.odin 2022-11-11 16:15:21 +00:00
gingerBill
6a4e44607c Fix json marshal for maps 2022-11-08 14:59:09 +00:00
gingerBill
6dd4d1a924 Correct reflection usage of maps 2022-11-08 11:50:55 +00:00
Michael Kutowski
f65bdf5733 else statement to allow skipping unused struct fields 2022-09-30 19:40:41 +02:00
gingerBill
a6d3cbe824 Correct json.unmarshal for maps 2022-09-21 13:10:06 +01:00
gingerBill
40bcfc7c8d Update json/unmarshal.odin for the new runtime.__dynamic_map_set 2022-09-17 13:05:14 +01:00
gingerBill
1e595f2e26 Add missing import 2022-09-14 18:27:02 +01:00
gingerBill
28ad4f8623 Use json field tag for json.marshal 2022-09-14 18:21:12 +01:00
gingerBill
db1b7b2d21 Allow for ignored fields in struct for json.unmarshal 2022-09-14 16:52:01 +01:00
Despacito696969
ecfea027a0 Fixed marshal_to_writer not supporting i128
Previously json.marshal(i128(696969)) would print 0 as there was no `u = i128(i)` initialization.
2022-08-26 23:49:33 +02:00
Michael Kutowski
b739044e69 Update marshal.odin 2022-08-12 13:59:11 +02:00
Michael Kutowski
9e0107c9fc add new soa type, my bad wasnt on master 2022-08-12 13:50:19 +02:00
Michael Kutowski
107e016508 switch styling and opt.spaces max 2022-08-12 13:42:19 +02:00
gingerBill
57b20e634b Merge branch 'master' into pretty-json-2 2022-08-11 16:14:27 +01:00
Michael Kutowski
425dec8bb8 add uint as hex option 2022-08-08 18:28:28 +02:00
gingerBill
5e3cf45df3 Add #soa pointer type to aid with refactoring to #soa data types
a: #soa[16]Foo
p := &a[6]
#assert(type_of(p) == #soa^#soa[16]Foo)
p^.x = 123
p.x = 123
2022-08-08 15:07:00 +01:00
Michael Kutowski
53e0d182af ...bad paste 2022-08-05 18:56:14 +02:00
Michael Kutowski
a6fa41e290 marshal output options with pretty option and other config 2022-08-05 18:53:29 +02:00
William Roe
d913155972 Fix bug unmarshalling JSON with assertions disabled
When asserts are disabled, code within the assert isn't run. Having
expect_token within an assert means that the state of the Parser is
mutated when asserts are run, but not when they aren't.

There's already a wrapper procedure for this pattern, which I have
reused here.
2022-07-28 13:56:14 +01:00
gingerBill
c90b7c38f1 Rename strings.Builder procedures to be consistent with the rest of the core library 2022-07-11 11:50:08 +01:00