nitcc: add an example of a monkey-patching of a Lexer to add behavior.
[nit.git] / tests / sav / nitce / test_json_deserialization_alt1.res
1 # Nit:
2 <A: true a 0.123 1234 asdf false p4ssw0rd>
3
4 # Json:
5 {"__kind": "obj", "__id": 0, "__class": "A","b": true,"c": {"__kind": "char", "__val": "a"},"f": 0.123,"i": 1234,"serialization_specific_name": "asdf","n": null}
6
7 # Back in Nit:
8 <A: true a 0.123 1234 asdf false p4ssw0rd>
9
10 # Nit:
11 <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>
12
13 # Json:
14 {"__kind": "obj", "__id": 0, "__class": "B","b": false,"c": {"__kind": "char", "__val": "b"},"f": 123.123,"i": 2345,"serialization_specific_name": "hjkl","n": 12,"ii": 1111,"ss": "qwer"}
15
16 # Back in Nit:
17 <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>
18
19 # Nit:
20 <C: <A: true a 0.123 1234 asdf false p4ssw0rd> <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>>
21
22 # Json:
23 {"__kind": "obj", "__id": 0, "__class": "C","a": {"__kind": "obj", "__id": 1, "__class": "A","b": true,"c": {"__kind": "char", "__val": "a"},"f": 0.123,"i": 1234,"serialization_specific_name": "asdf","n": null},"b": {"__kind": "obj", "__id": 2, "__class": "B","b": false,"c": {"__kind": "char", "__val": "b"},"f": 123.123,"i": 2345,"serialization_specific_name": "hjkl","n": 12,"ii": 1111,"ss": "qwer"},"aa": {"__kind": "ref", "__id": 1}}
24
25 # Back in Nit:
26 <C: <A: true a 0.123 1234 asdf false p4ssw0rd> <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>>
27
28 # Nit:
29 <D: <B: <A: false b 123.123 2345 new line ->
30 <- false p4ssw0rd> 1111         f"\r\/> true>
31
32 # Json:
33 {"__kind": "obj", "__id": 0, "__class": "D","b": false,"c": {"__kind": "char", "__val": "b"},"f": 123.123,"i": 2345,"serialization_specific_name": "new line ->\n<-","n": null,"ii": 1111,"ss": "\tf\"\r\\/","d": {"__kind": "ref", "__id": 0}}
34
35 # Back in Nit:
36 <D: <B: <A: false b 123.123 2345 new line ->
37 <- false p4ssw0rd> 1111         f"\r\/> true>
38
39 # Nit:
40 <E: a: hello, 1234, 123.4; b: hella, 2345, 234.5>
41
42 # Json:
43 {"__kind": "obj", "__id": 0, "__class": "E","a": {"__kind": "obj", "__id": 1, "__class": "Array","__items": ["hello",1234,123.4]},"b": {"__kind": "obj", "__id": 2, "__class": "Array","__items": ["hella",2345,234.5]}}
44
45 # Back in Nit:
46 <E: a: hello, 1234, 123.4; b: hella, 2345, 234.5>
47
48 Deserialization Error: Doesn't know how to deserialize class "Array"
49 Deserialization Error: Wrong type on `E::a` expected `Unknown type`, got `null`
50 Deserialization Error: Doesn't know how to deserialize class "Array"
51 Deserialization Error: Wrong type on `E::b` expected `Unknown type`, got `null`
52 # Nit:
53 <E: 2222>
54
55 # Json:
56 {"__kind": "obj", "__id": 0, "__class": "F","n": 2222}
57
58 # Back in Nit:
59 null
60
61 Deserialization Error: Doesn't know how to deserialize class "F"
62 # Nit:
63 <E: 33.33>
64
65 # Json:
66 {"__kind": "obj", "__id": 0, "__class": "F","n": 33.33}
67
68 # Back in Nit:
69 null
70
71 Deserialization Error: Doesn't know how to deserialize class "F"
72 # Nit:
73 <G: hs: -1, 0; s: one, two; hm: one. 1, two. 2; am: three. 3, four. 4>
74
75 # Json:
76 {"__kind": "obj", "__id": 0, "__class": "G","hs": {"__kind": "obj", "__id": 1, "__class": "HashSet","__items": [-1,0]},"s": {"__kind": "obj", "__id": 2, "__class": "ArraySet","__items": ["one","two"]},"hm": {"__kind": "obj", "__id": 3, "__class": "HashMap", "__length": 2,"__keys": ["one","two"],"__values": [1,2]},"am": {"__kind": "obj", "__id": 4, "__class": "ArrayMap", "__length": 2,"__keys": ["three","four"],"__values": ["3","4"]}}
77
78 # Back in Nit:
79 <G: hs: ; s: ; hm: ; am: >
80
81 Deserialization Error: Doesn't know how to deserialize class "HashSet"
82 Deserialization Error: Wrong type on `G::hs` expected `Unknown type`, got `null`
83 Deserialization Error: Doesn't know how to deserialize class "ArraySet"
84 Deserialization Error: Wrong type on `G::s` expected `Set[String]`, got `null`
85 Deserialization Error: Doesn't know how to deserialize class "HashMap"
86 Deserialization Error: Wrong type on `G::hm` expected `Unknown type`, got `null`
87 Deserialization Error: Doesn't know how to deserialize class "ArrayMap"
88 Deserialization Error: Wrong type on `G::am` expected `Unknown type`, got `null`