diff --git a/lib_json/src/main/x/json.x b/lib_json/src/main/x/json.x index dae394772..c32757e9f 100644 --- a/lib_json/src/main/x/json.x +++ b/lib_json/src/main/x/json.x @@ -19,12 +19,19 @@ module json.xtclang.org /** * JSON primitive types are all JSON values except for arrays and objects. */ - typedef (Nullable | Boolean | IntLiteral | FPLiteral | String) as Primitive; +// typedef (Nullable | Boolean | IntLiteral | FPLiteral | String) as Primitive; + + // or maybe: + +// typedef (Nullable | Boolean | IntLiteral | IntNumber | FPLiteral | FPNumber | String) as Primitive; + + // or even: +// typedef (Nullable | Boolean | ecstasy.numbers.IntConvertible | ecstasy.numbers.FPConvertible | String) as Primitive; /** * JSON types include primitive types, array types, and map types. */ - typedef (Primitive | Map | Doc[]) as Doc; + typedef (Primitive | Map | List) as Doc; /** * A type representing a JSON Array. diff --git a/lib_json/src/main/x/json/JsonObject.x b/lib_json/src/main/x/json/JsonObject.x index 78d122cdb..774510b3b 100644 --- a/lib_json/src/main/x/json/JsonObject.x +++ b/lib_json/src/main/x/json/JsonObject.x @@ -27,9 +27,6 @@ class JsonObject // this doesn't work atm, but it should; will make put ops more usable // @Op("[]=") void putInPlace(Key key, Int value) = putInPlace(key, value.toIntLiteral()); // -// @Op("[]=") void putInPlace(Key key, FPNumber value) = putInPlace(key, value.toIntLiteral()); - - @Auto - Doc toDoc() = jsonObject; +// @Op("[]=") void putInPlace(Key key, FPNumber value) = putInPlace(key, value.toFPLiteral()); } diff --git a/lib_json/src/main/x/json/Parser.x b/lib_json/src/main/x/json/Parser.x index 230776bc0..0d93ee4f7 100644 --- a/lib_json/src/main/x/json/Parser.x +++ b/lib_json/src/main/x/json/Parser.x @@ -453,7 +453,7 @@ class Parser * @return an array of JSON values */ @Override - Array parseArray() { + List parseArray() { JsonArray array = json.newArray(); expect(ArrayEnter); if (!match(ArrayExit)) { @@ -807,7 +807,7 @@ class Parser Token[] skipRemaining(Token[]? skipped = Null); Doc parseDoc(); (Token first, Token last) skipDoc(Token[]? skipped = Null); - Array parseArray(); + List parseArray(); (Token first, Token last) skipArray(Token[]? skipped = Null); conditional ArrayParser matchArray(); ArrayParser expectArray(); @@ -890,9 +890,9 @@ class Parser } @Override - Array parseArray() { + List parseArray() { checkEof(); - Array array = raw.parseArray(); + List array = raw.parseArray(); checkDelimiter(); return array; } diff --git a/manualTests/src/main/x/TestSimple.x b/manualTests/src/main/x/TestSimple.x index 1459304f5..70c666da3 100644 --- a/manualTests/src/main/x/TestSimple.x +++ b/manualTests/src/main/x/TestSimple.x @@ -24,7 +24,7 @@ module TestSimple { Doc getDoc(Dec d = 1) { JsonObject o = json.newObject(); - o["a"] = d/*this will not be needed*/.toFPLiteral(); + o["a"] = d /*this will not be needed*/.toFPLiteral(); return o; } }