Skip to content

Commit 5372fcb

Browse files
committed
feat: enhance JSON pointer error messages with path info
- Add path parameter to all JSON pointer error messages - Update yyjson library to version 0.11.1 - Improve debugging experience by showing exact path in error logs
1 parent bf2aacd commit 5372fcb

7 files changed

Lines changed: 19102 additions & 19410 deletions

File tree

pushbuild.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ some meaningless str
22
8c68c9448936fdfc437994f46753cdda63318509
33
f30621f6c6bb134dcba0812438f47571f7bb7aee
44
597c28947ff356399c998661f25e44b2
5-
a1b8e64c0495b82ec41f8f020d3e3cd1
5+
a1b8e64c0495b82ec41f8f020d3e3cd1
6+
e33332b9577da63d2ba281a660101493

scripting/include/yyjson.inc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ enum YYJSON_READ_FLAG
3939
YYJSON_READ_ALLOW_INF_AND_NAN = 1 << 4, // Allow nan/inf number (non-standard JSON)
4040
YYJSON_READ_NUMBER_AS_RAW = 1 << 5, // Read numbers as raw strings
4141
YYJSON_READ_ALLOW_INVALID_UNICODE = 1 << 6, // Allow invalid unicode when parsing string
42-
YYJSON_READ_BIGNUM_AS_RAW = 1 << 7 // Read big numbers as raw strings
42+
YYJSON_READ_BIGNUM_AS_RAW = 1 << 7, // Read big numbers as raw strings
43+
YYJSON_READ_ALLOW_BOM = 1 << 8 // Allow BOM (Byte Order Mark) at the beginning of the JSON string
4344
}
4445

4546
// JSON writer flags for serialization behavior
@@ -53,7 +54,17 @@ enum YYJSON_WRITE_FLAG
5354
YYJSON_WRITE_INF_AND_NAN_AS_NULL = 1 << 4, // Write inf/nan as null
5455
YYJSON_WRITE_ALLOW_INVALID_UNICODE = 1 << 5, // Allow invalid unicode when encoding string
5556
YYJSON_WRITE_PRETTY_TWO_SPACES = 1 << 6, // Use 2 spaces for indent when pretty print
56-
YYJSON_WRITE_NEWLINE_AT_END = 1 << 7 // Add newline at the end of output
57+
YYJSON_WRITE_NEWLINE_AT_END = 1 << 7, // Add newline at the end of output
58+
YYJSON_WRITE_FP_TO_FLOAT = 1 << 27 // Write floating-point numbers using single-precision (float)
59+
}
60+
61+
/** Write floating-point number using fixed-point notation
62+
- This is similar to ECMAScript Number.prototype.toFixed(prec) but with trailing zeros removed. The prec ranges from 1 to 15
63+
- This will produce shorter output but may lose some precision
64+
*/
65+
stock YYJSON_WRITE_FLAG YYJSON_WRITE_FP_TO_FIXED(int n)
66+
{
67+
return view_as<YYJSON_WRITE_FLAG>(n << 28);
5768
}
5869

5970
// Sort order for arrays and objects

src/json_natives.cpp

Lines changed: 31 additions & 31 deletions
Large diffs are not rendered by default.

src/smsdk_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define SMEXT_CONF_NAME "SourceMod YYJSON Extension"
55
#define SMEXT_CONF_DESCRIPTION "Provide JSON Native"
6-
#define SMEXT_CONF_VERSION "1.1.2rc"
6+
#define SMEXT_CONF_VERSION "1.1.3"
77
#define SMEXT_CONF_AUTHOR "ProjectSky"
88
#define SMEXT_CONF_URL "https://github.com/ProjectSky/sm-ext-yyjson"
99
#define SMEXT_CONF_LOGTAG "yyjson"

third_party/yyjson/add-floating-point-equality-comparison.patch

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)