summaryrefslogtreecommitdiff
path: root/ddl/out/csharp/LambdaCube.TypeInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ddl/out/csharp/LambdaCube.TypeInfo.cs')
-rw-r--r--ddl/out/csharp/LambdaCube.TypeInfo.cs308
1 files changed, 308 insertions, 0 deletions
diff --git a/ddl/out/csharp/LambdaCube.TypeInfo.cs b/ddl/out/csharp/LambdaCube.TypeInfo.cs
new file mode 100644
index 0000000..c92a747
--- /dev/null
+++ b/ddl/out/csharp/LambdaCube.TypeInfo.cs
@@ -0,0 +1,308 @@
1// generated file, do not modify!
2// 2016-11-11T11:17:03.605012000000Z
3
4using System;
5using System.Linq;
6using System.Collections.Generic;
7using Newtonsoft.Json.Linq;
8
9using LambdaCube.IR;
10
11namespace LambdaCube.TypeInfo {
12 public class Range {
13 public enum Tag {
14 Range
15 };
16 public Tag tag;
17 };
18
19 namespace data {
20 public class Range : LambdaCube.TypeInfo.Range {
21 public int startLine;
22 public int startColumn;
23 public int endLine;
24 public int endColumn;
25 public Range() { tag = LambdaCube.TypeInfo.Range.Tag.Range; }
26 };
27 }
28 public class TypeInfo {
29 public enum Tag {
30 TypeInfo
31 };
32 public Tag tag;
33 };
34
35 namespace data {
36 public class TypeInfo : LambdaCube.TypeInfo.TypeInfo {
37 public global::LambdaCube.TypeInfo.Range range;
38 public string text;
39 public TypeInfo() { tag = LambdaCube.TypeInfo.TypeInfo.Tag.TypeInfo; }
40 };
41 }
42 public class WarningInfo {
43 public enum Tag {
44 WarningInfo
45 };
46 public Tag tag;
47 };
48
49 namespace data {
50 public class WarningInfo : LambdaCube.TypeInfo.WarningInfo {
51 public global::LambdaCube.TypeInfo.Range wRange;
52 public string wText;
53 public WarningInfo() { tag = LambdaCube.TypeInfo.WarningInfo.Tag.WarningInfo; }
54 };
55 }
56 public class ErrorInfo {
57 public enum Tag {
58 ErrorInfo
59 };
60 public Tag tag;
61 };
62
63 namespace data {
64 public class ErrorInfo : LambdaCube.TypeInfo.ErrorInfo {
65 public global::LambdaCube.TypeInfo.Range eRange;
66 public string eText;
67 public ErrorInfo() { tag = LambdaCube.TypeInfo.ErrorInfo.Tag.ErrorInfo; }
68 };
69 }
70 public class CompileResult {
71 public enum Tag {
72 CompileError,
73 Compiled
74 };
75 public Tag tag;
76 };
77
78 namespace data {
79 public class CompileError : LambdaCube.TypeInfo.CompileResult {
80 public string _0;
81 public List<global::LambdaCube.TypeInfo.TypeInfo> _1;
82 public List<global::LambdaCube.TypeInfo.WarningInfo> _2;
83 public List<global::LambdaCube.TypeInfo.ErrorInfo> _3;
84 public CompileError() { tag = LambdaCube.TypeInfo.CompileResult.Tag.CompileError; }
85 };
86 public class Compiled : LambdaCube.TypeInfo.CompileResult {
87 public string _0;
88 public string _1;
89 public global::LambdaCube.TypeInfo.Pipeline _2;
90 public List<global::LambdaCube.TypeInfo.TypeInfo> _3;
91 public List<global::LambdaCube.TypeInfo.WarningInfo> _4;
92 public Compiled() { tag = LambdaCube.TypeInfo.CompileResult.Tag.Compiled; }
93 };
94 }
95
96 // JSON deserializer
97 public enum Type {
98 Int,
99 String,
100 Array_ErrorInfo,
101 Array_TypeInfo,
102 Array_WarningInfo,
103 CompileResult,
104 ErrorInfo,
105 Pipeline,
106 Range,
107 TypeInfo,
108 WarningInfo
109 }
110
111 public class Loader {
112 public static object fromJSON(Type type, JToken obj) {
113 switch (type) {
114 case Type.Int: return (int)obj;
115 case Type.String: return (string)obj;
116 case Type.Array_ErrorInfo: return ((JArray)obj).Select(x => (global::LambdaCube.TypeInfo.ErrorInfo)fromJSON (Type.ErrorInfo, x)).ToList();
117 case Type.Array_TypeInfo: return ((JArray)obj).Select(x => (global::LambdaCube.TypeInfo.TypeInfo)fromJSON (Type.TypeInfo, x)).ToList();
118 case Type.Array_WarningInfo: return ((JArray)obj).Select(x => (global::LambdaCube.TypeInfo.WarningInfo)fromJSON (Type.WarningInfo, x)).ToList();
119
120 case Type.Range: {
121 string tag = (string)obj["tag"];
122 switch (tag) {
123 case "Range": {
124 data.Range tv = new data.Range();
125 tv.startLine = (int)fromJSON(Type.Int,obj["startLine"]);
126 tv.startColumn = (int)fromJSON(Type.Int,obj["startColumn"]);
127 tv.endLine = (int)fromJSON(Type.Int,obj["endLine"]);
128 tv.endColumn = (int)fromJSON(Type.Int,obj["endColumn"]);
129 return tv;
130 }
131 default: throw new Exception("unknown constructor: " + tag);
132 }
133 }
134 case Type.TypeInfo: {
135 string tag = (string)obj["tag"];
136 switch (tag) {
137 case "TypeInfo": {
138 data.TypeInfo tv = new data.TypeInfo();
139 tv.range = (global::LambdaCube.TypeInfo.Range)fromJSON(Type.Range,obj["range"]);
140 tv.text = (string)fromJSON(Type.String,obj["text"]);
141 return tv;
142 }
143 default: throw new Exception("unknown constructor: " + tag);
144 }
145 }
146 case Type.WarningInfo: {
147 string tag = (string)obj["tag"];
148 switch (tag) {
149 case "WarningInfo": {
150 data.WarningInfo tv = new data.WarningInfo();
151 tv.wRange = (global::LambdaCube.TypeInfo.Range)fromJSON(Type.Range,obj["wRange"]);
152 tv.wText = (string)fromJSON(Type.String,obj["wText"]);
153 return tv;
154 }
155 default: throw new Exception("unknown constructor: " + tag);
156 }
157 }
158 case Type.ErrorInfo: {
159 string tag = (string)obj["tag"];
160 switch (tag) {
161 case "ErrorInfo": {
162 data.ErrorInfo tv = new data.ErrorInfo();
163 tv.eRange = (global::LambdaCube.TypeInfo.Range)fromJSON(Type.Range,obj["eRange"]);
164 tv.eText = (string)fromJSON(Type.String,obj["eText"]);
165 return tv;
166 }
167 default: throw new Exception("unknown constructor: " + tag);
168 }
169 }
170 case Type.CompileResult: {
171 string tag = (string)obj["tag"];
172 switch (tag) {
173 case "CompileError": {
174 data.CompileError tv = new data.CompileError();
175 tv._0 = (string)fromJSON(Type.String,obj["arg0"]);
176 tv._1 = (List<global::LambdaCube.TypeInfo.TypeInfo>)fromJSON(Type.Array_TypeInfo,obj["arg1"]);
177 tv._2 = (List<global::LambdaCube.TypeInfo.WarningInfo>)fromJSON(Type.Array_WarningInfo,obj["arg2"]);
178 tv._3 = (List<global::LambdaCube.TypeInfo.ErrorInfo>)fromJSON(Type.Array_ErrorInfo,obj["arg3"]);
179 return tv;
180 }
181 case "Compiled": {
182 data.Compiled tv = new data.Compiled();
183 tv._0 = (string)fromJSON(Type.String,obj["arg0"]);
184 tv._1 = (string)fromJSON(Type.String,obj["arg1"]);
185 tv._2 = (global::LambdaCube.TypeInfo.Pipeline)fromJSON(Type.Pipeline,obj["arg2"]);
186 tv._3 = (List<global::LambdaCube.TypeInfo.TypeInfo>)fromJSON(Type.Array_TypeInfo,obj["arg3"]);
187 tv._4 = (List<global::LambdaCube.TypeInfo.WarningInfo>)fromJSON(Type.Array_WarningInfo,obj["arg4"]);
188 return tv;
189 }
190 default: throw new Exception("unknown constructor: " + tag);
191 }
192 }
193 }
194 throw new Exception("unknown type");
195 return null;
196 }
197
198 public static JToken toJSON(Range v) {
199 var obj = new JObject();
200 switch (v.tag) {
201 case Range.Tag.Range:
202 obj["tag"] = "Range";
203 {
204 var tv = (data.Range)v;
205 obj["startLine"] = toJSON(tv.startLine);
206 obj["startColumn"] = toJSON(tv.startColumn);
207 obj["endLine"] = toJSON(tv.endLine);
208 obj["endColumn"] = toJSON(tv.endColumn);
209 }
210 break;
211 }
212 return obj;
213 }
214 public static JToken toJSON(TypeInfo v) {
215 var obj = new JObject();
216 switch (v.tag) {
217 case TypeInfo.Tag.TypeInfo:
218 obj["tag"] = "TypeInfo";
219 {
220 var tv = (data.TypeInfo)v;
221 obj["range"] = toJSON(tv.range);
222 obj["text"] = toJSON(tv.text);
223 }
224 break;
225 }
226 return obj;
227 }
228 public static JToken toJSON(WarningInfo v) {
229 var obj = new JObject();
230 switch (v.tag) {
231 case WarningInfo.Tag.WarningInfo:
232 obj["tag"] = "WarningInfo";
233 {
234 var tv = (data.WarningInfo)v;
235 obj["wRange"] = toJSON(tv.wRange);
236 obj["wText"] = toJSON(tv.wText);
237 }
238 break;
239 }
240 return obj;
241 }
242 public static JToken toJSON(ErrorInfo v) {
243 var obj = new JObject();
244 switch (v.tag) {
245 case ErrorInfo.Tag.ErrorInfo:
246 obj["tag"] = "ErrorInfo";
247 {
248 var tv = (data.ErrorInfo)v;
249 obj["eRange"] = toJSON(tv.eRange);
250 obj["eText"] = toJSON(tv.eText);
251 }
252 break;
253 }
254 return obj;
255 }
256 public static JToken toJSON(CompileResult v) {
257 var obj = new JObject();
258 switch (v.tag) {
259 case CompileResult.Tag.CompileError:
260 obj["tag"] = "CompileError";
261 {
262 var tv = (data.CompileError)v;
263 obj["arg0"] = toJSON(tv._0);
264 obj["arg1"] = toJSON(tv._1);
265 obj["arg2"] = toJSON(tv._2);
266 obj["arg3"] = toJSON(tv._3);
267 }
268 break;
269 case CompileResult.Tag.Compiled:
270 obj["tag"] = "Compiled";
271 {
272 var tv = (data.Compiled)v;
273 obj["arg0"] = toJSON(tv._0);
274 obj["arg1"] = toJSON(tv._1);
275 obj["arg2"] = toJSON(tv._2);
276 obj["arg3"] = toJSON(tv._3);
277 obj["arg4"] = toJSON(tv._4);
278 }
279 break;
280 }
281 return obj;
282 }
283
284 public static JToken toJSON(int v) { return new JValue(v); }
285 public static JToken toJSON(string v) { return new JValue(v); }
286 public static JToken toJSON(List<global::LambdaCube.TypeInfo.ErrorInfo> v) {
287 var obj = new JArray();
288 foreach (var i in v) {
289 obj.Add(toJSON(i));
290 }
291 return obj;
292 }
293 public static JToken toJSON(List<global::LambdaCube.TypeInfo.TypeInfo> v) {
294 var obj = new JArray();
295 foreach (var i in v) {
296 obj.Add(toJSON(i));
297 }
298 return obj;
299 }
300 public static JToken toJSON(List<global::LambdaCube.TypeInfo.WarningInfo> v) {
301 var obj = new JArray();
302 foreach (var i in v) {
303 obj.Add(toJSON(i));
304 }
305 return obj;
306 }
307 }
308}