-
Notifications
You must be signed in to change notification settings - Fork 0
/
type_mapping.json
76 lines (76 loc) · 2.38 KB
/
type_mapping.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
"native": {
"bool": "bool",
"u8": "u8",
"u16": "u16",
"u32": "u32",
"u64": "u64",
"i8": "i8",
"i16": "i16",
"i32": "i32",
"i64": "i64",
"f32": "f32",
"f64": "f64",
"UUID": "Uuid",
"varint": "VarInt",
"varlong": "VarLong",
"pstring": "PrefixedString<'a, $countType>",
"buffer": "PrefixedBuffer<'a, $countType>",
"option": "Option<$0>",
"void": "Void",
"restBuffer": "RestBuffer<'a>",
"nbt": "Nbt",
"optionalNbt": "OptionalNbt"
},
"literals": {
"varint": {
"inner": "i32",
"lit": "{}i32",
"new": "VInt::<i32>({})",
"unwrap": "{}.0"
},
"varlong": {
"inner": "i64",
"lit": "{}i64",
"new": "VInt::<i64>({})",
"unwrap": "{}.0"
},
"string": {
"inner": "&str",
"lit": "\"{}\"",
"new": "PrefixedString::<'static, VarInt>({}, core::marker::PhantomData)",
"unwrap": "{}.0"
}
},
"prelude": {
"global": [
"#[allow(unused_imports)]",
"use protocol_lib::{Packet, types::*};",
"use nom::{combinator::map, sequence::tuple};",
"type VarInt = VInt<i32>;",
"type VarLong = VInt<i64>;",
"type VarString<'a> = PrefixedString<'a, VarInt>;",
"type VarStringArray<'a> = PrefixedArray<PrefixedString<'a, VarInt>, VarInt>;",
"type VarArray<T> = PrefixedArray<T, VarInt>;",
"type VarBuffer<'a> = PrefixedBuffer<'a, VarInt>;"
],
"all": [
"use crate::test::*;",
"use protocol_lib::Packet;",
"use nom::{combinator::map, sequence::tuple};"
]
},
"regex": [
["PrefixedString<'a, VarInt>", "VarString<'a>"],
["PrefixedBuffer<'a, VarInt>", "VarBuffer<'a>"],
["(?V1)PrefixedArray<(([a-zA-Z]*<(?1)*>)|[^<>]+), VarInt>", "VarArray<\\1>"],
["VarArray<VarString<'a>>", "VarStringArray<'a>"],
["toClient", "clientbound"],
["toServer", "serverbound"],
["u_u_i_d", "uuid"],
["_i_d", "_id"],
["([^a-zA-Z0-9])Value([^a-zA-Z0-9])", "\\1EntityMetadata\\2"],
["nom::combinator::map", "map"],
["nom::sequence::tuple", "tuple"]
]
}