aboutsummaryrefslogtreecommitdiff
path: root/generator/plugin_pb.nim
blob: f8d9188829f676c7acdd6499458d4e03eb0f51aa (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import intsets

import protobuf/types
import protobuf/gen
import protobuf/stream

import descriptor_pb

const
    VersionDesc = MessageDesc(
        name: "Version",
        fields: @[
            FieldDesc(
                name: "major",
                number: 1,
                ftype: FieldType.Int32,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "minor",
                number: 2,
                ftype: FieldType.Int32,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "patch",
                number: 3,
                ftype: FieldType.Int32,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "suffix",
                number: 4,
                ftype: FieldType.String,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            )
        ]
    )

    CodeGeneratorRequestDesc = MessageDesc(
        name: "CodeGeneratorRequest",
        fields: @[
            FieldDesc(
                name: "file_to_generate",
                number: 1,
                ftype: FieldType.String,
                label: FieldLabel.Repeated,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "parameter",
                number: 2,
                ftype: FieldType.String,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "proto_file",
                number: 15,
                ftype: FieldType.Message,
                label: FieldLabel.Repeated,
                typeName: "FileDescriptorProto",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "compiler_version",
                number: 3,
                ftype: FieldType.Message,
                label: FieldLabel.Optional,
                typeName: "Version",
                packed: false,
                oneofIdx: -1,
            )
        ]
    )

    CodeGeneratorResponseDesc = MessageDesc(
        name: "CodeGeneratorResponse",
        fields: @[
            FieldDesc(
                name: "error",
                number: 1,
                ftype: FieldType.String,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "file",
                number: 15,
                ftype: FieldType.Message,
                label: FieldLabel.Repeated,
                typeName: "CodeGeneratorResponse_File",
                packed: false,
                oneofIdx: -1,
            ),
        ]
    )

    CodeGeneratorResponse_FileDesc = MessageDesc(
        name: "CodeGeneratorResponse_File",
        fields: @[
            FieldDesc(
                name: "name",
                number: 1,
                ftype: FieldType.String,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "insertion_point",
                number: 2,
                ftype: FieldType.String,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
            FieldDesc(
                name: "content",
                number: 15,
                ftype: FieldType.String,
                label: FieldLabel.Optional,
                typeName: "",
                packed: false,
                oneofIdx: -1,
            ),
        ]
    )

generateMessageType(VersionDesc)
generateMessageProcs(VersionDesc)

generateMessageType(CodeGeneratorRequestDesc)
generateMessageProcs(CodeGeneratorRequestDesc)

generateMessageType(CodeGeneratorResponse_FileDesc)
generateMessageProcs(CodeGeneratorResponse_FileDesc)

generateMessageType(CodeGeneratorResponseDesc)
generateMessageProcs(CodeGeneratorResponseDesc)