Commit Graph

179 Commits

Author SHA1 Message Date
Jacob Young
b55377a5ab x86_64: pass more tests
* 128-bit integer multiplication with overflow
 * more instruction encodings used by std inline asm
 * implement the `try_ptr` air instruction
 * follow correct stack frame abi
 * enable full panic handler
 * enable stack traces
2023-10-25 04:28:30 -04:00
Jacob Young
fe93332ba2 x86_64: implement enough to pass unicode tests
* implement vector comparison
 * implement reduce for bool vectors
 * fix `@memcpy` bug
 * enable passing std tests
2023-10-23 22:42:18 -04:00
Jacob Young
27fe945a00 Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""
This reverts commit 6f0198cadb.
2023-10-22 15:46:43 -04:00
Andrew Kelley
6f0198cadb Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"
This reverts commit 0c99ba1eab, reversing
changes made to 5f92b070bf.

This caused a CI failure when it landed in master branch due to a
128-bit `@byteSwap` in std.mem.
2023-10-22 12:16:35 -07:00
Jacob Young
32e85d44eb x86_64: disable failing tests, enable test-std testing 2023-10-21 10:55:41 -04:00
Jacob Young
2e6e39a700 x86_64: fix bugs and disable erroring tests 2023-10-21 10:55:41 -04:00
Jonathan Marler
223f62acbd
std.json: add fmt function (#17055)
Adds std.json.fmt which returns a std.fmt Formatter that formats any
given value using std.json.stringify.
2023-09-13 18:24:59 -04:00
Josh Wolfe
8924f81d8c
std.json: Unify stringify and writeStream (#16405) 2023-07-21 19:56:46 -04:00
Josh Wolfe
874d2dd9f7
std.json: add generic hash map that parses/stringifies with arbitrary string keys (#16366)
* expose innerParseFromValue
2023-07-09 22:18:59 -04:00
Garrett
131bfe2f74
std.json: expose innerParse and add .allocate option (#16312) 2023-07-08 22:49:31 -04:00
Josh Wolfe
3f04231600 std: re-pub new json symbols in json.zig 2023-06-25 04:56:38 -07:00
Josh Wolfe
32cb9462ff
std: Support user-provided jsonParse method. Unify json.Parser and json.parse* (#15705) 2023-06-19 11:21:37 -04:00
Josh Wolfe
018b743c7a
std: Rewrite low-level json api to support streaming (#15602) 2023-05-13 14:31:53 -04:00
dweiller
bd3360e03d convert s[start..start+len] to s[start..][0..len] 2023-05-07 15:55:21 +10:00
Linus Groh
94e30a756e std: fix a bunch of typos
The majority of these are in comments, some in doc comments which might
affect the generated documentation, and a few in parameter names -
nothing that should be breaking, however.
2023-04-30 18:16:04 -07:00
Andrew Kelley
6261c13731 update codebase to use @memset and @memcpy 2023-04-28 13:24:43 -07:00
Janne Hellsten
61236c2aa1
std: @Vector support for std.json.parse 2023-04-26 00:52:17 +03:00
mateusz
0866396308
std.json: allow returning custom errors from custom stringify 2023-04-07 15:01:09 +03:00
Marcus Ramse
1e087d3a64 std.json: support tuples 2023-03-21 15:01:45 +02:00
r00ster91
c0789b4814 std.json.stringify: support [*:0]const u8 2023-03-08 19:26:03 +01:00
r00ster91
7e3591bedd std.json.parseInternal: use switches instead of ifs 2023-03-08 19:25:53 +01:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Veikka Tuominen
fc48467a97
Merge pull request #14548 from schmee/std-json-fixes
Some std.json fixes
2023-02-13 16:24:29 +02:00
Leo Constantinides
25d6b8c1f1
std: support deserialising JSON strings containing escape seqences into sentinel slice 2023-02-13 15:44:34 +02:00
John Schmidt
b1dd4b17d8 std.json: don't free struct default values
Closes https://github.com/ziglang/zig/issues/9509.
2023-02-04 20:51:15 +01:00
John Schmidt
b42caff2a2 std.json: avoid dangling pointers in ValueTree
Closes https://github.com/ziglang/zig/issues/5229.
2023-02-04 20:34:47 +01:00
John Schmidt
73c857415e std.json: fix parsing of structs with default value const pointers 2023-02-04 18:28:36 +01:00
Jon-Eric Cook
4c11684184
std.json: check output and source lengths in std.json 2023-01-28 16:26:36 +00:00
r00ster91
aac2d6b56f std.builtin: rename Type.UnionField and Type.StructField's field_type to type 2022-12-17 14:11:33 +01:00
Andrew Kelley
50eb7983cd remove most conditional compilation based on stage1
There are still a few occurrences of "stage1" in the standard library
and self-hosted compiler source, however, these instances need a bit
more careful inspection to ensure no breakage.
2022-12-06 20:38:54 -07:00
Andrew Kelley
ceb0a632cf std.mem.Allocator: allow shrink to fail
closes #13535
2022-11-29 23:30:38 -07:00
Veikka Tuominen
541b3e3a31 Sema: check pointer qualifiers before implicit cast
Closes #12881
2022-09-20 00:50:13 +03:00
Jonathan Marler
f598234ee8 std.json: expose encodeJsonString and encodeJsonStringChars
Expose 2 functions from std.json.  These functions take a slice of bytes
and forward them to a given writer as a JSON encoded string.

The use case I have for this is in a custom JsonStringWriter.  This writer
takes data and automatically encodes it as JSON string characters and
forwards it to an underlying writer.  I use this JsonStringWriter in
combination with std.fmt.format to go directly from a format string/arg
pair to JSON.  This way I don't have to format my string into a separate
buffer first and encode it afterwards, which avoids the need to create
a temporary buffer to hold the unencoded but formatted string.
2022-07-24 11:51:59 +03:00
ominitay
889efddd1a std.json: Fix parsing of large numbers
Numbers greater than about 2^53 are encoded as strings in JSON.
std.json.parseInternal previously errored out in this condition.
2022-07-23 13:52:16 +03:00
Andrew Kelley
c9006d9479 std.json: move tests to json/test.zig file
This accomplishes two things:
 * Works around #8442 by putting stage1-specific logic in to disable all
   the std.json tests.
 * Slightly reduces installation size of zig since std lib files ending
   in "test.zig" are excluded from being installed.
2022-07-07 00:05:21 -07:00
May B
ea13437ac5
std.json: Support disabling indent (#11823)
Newline Delimited JSON (ndjson) expect compact json without newline inside its content
Add None to StringfyOptions.indent and move newline writeByte inside StringfyOptions.outputIndent
2022-06-29 11:53:01 +02:00
Veikka Tuominen
6d44c0a16c std: update tests to stage2 semantics 2022-06-03 20:21:20 +03:00
Andreas Reischuck
10a671ad09 std.json stringify fix object keys are always is strings
* extracted outputJsonString to avoid code duplication
2022-05-10 09:56:49 +02:00
OfekShochat
b57a356bb6 std.json add stringify struct with string as array 2022-05-10 09:55:06 +02:00
Andrew Kelley
0ffe82e624 std: use float builtins instead of std.math 2022-04-27 19:35:28 -07:00
Benjamin San Souci
e3c2cc1443
std.json: correctly handle sentinel terminated slices 2022-03-08 20:43:13 +02:00
Jonathan Marler
d805adddd6 deprecated TypeInfo in favor of Type
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-03-08 20:38:12 +02:00
sharpobject
17822e4a05 std.json: fix compile error for comptime fields
This is covered by an existing test which was already failing.
2022-02-13 14:33:17 +02:00
Andrew Kelley
449554a730 stage2: remove anytype fields from the language
closes #10705
2022-02-01 19:06:40 -07:00
Meghan Denny
0d0f277954 std: add json.stringifyAlloc 2022-01-17 12:32:02 +01:00
Lee Cannon
1093b09a98
allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
Lee Cannon
85de022c56
allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
Andrew Kelley
902df103c6 std lib API deprecations for the upcoming 0.9.0 release
See #3811
2021-11-30 00:13:07 -07:00
Marc Tiehuis
dcd88ae568 std/json: use bit-stack for nesting instead of large LLVM integer type
The stack has been adjusted so that instead of pushing to index 0 in the
integer we push to the current end/index of the underlying integer. This
means we don't require a shift for every limb after each push/pop and
instead only require a mask/or and add/sub on a single element of the array.

Fixes #5959.
2021-11-16 16:33:56 -05:00
Chris Heyes
5d2a77cd9a
Json Stringify option to not write out null optional fields (#8979) 2021-11-15 18:56:51 -05:00