json-native: enable float roundtrip in parser (NUMBER => float by '.'/exp); expand roundtrip smoke with more numeric cases

This commit is contained in:
Selfhosting Dev
2025-09-26 00:32:20 +09:00
parent 4503643af4
commit 6ce06501e1
30 changed files with 823 additions and 801 deletions

View File

@ -349,7 +349,7 @@ box JsonParser {
// ===== ユーティリティメソッド =====
// 数値文字列を数値情報に変換(簡易版
// 数値文字列を数値情報に変換(MVP
// 返り値: MapBox { kind:"int"|"float", value: <int|float_str> }
convert_number(number_str) {
local out = new MapBox()
@ -358,8 +358,11 @@ box JsonParser {
out.set("value", StringUtils.parse_integer(number_str))
return out
}
// Float detection disabled in MVP pending StringUtils float API stabilization
if false {
// 浮動小数点: 小数点または指数表記を含むものは文字列のまま保持
if number_str.indexOf != null {
// indexOfが提供されていない環境向けフォールバック
}
if StringUtils.contains(number_str, ".") or StringUtils.contains(number_str, "e") or StringUtils.contains(number_str, "E") {
out.set("kind", "float")
out.set("value", StringUtils.parse_float(number_str))
return out