1 using System;
2 using System.Collections;
3 using System.Windows;
4 using System.Lex;
5 using Cm.Ast;
6
7 class SyntaxTreeBuilder : Visitor
8 {
9 public nothrow SyntaxTreeBuilder(CmajorLexer& lexer_) : lexer(lexer_)
10 {
11 }
12 public TreeViewNode* GetRoot() const
13 {
14 return node.Release();
15 }
16 public HashMap<int, TreeViewNode*> GetIndexNodeMap()
17 {
18 return Rvalue(indexNodeMap);
19 }
20 public HashMap<TreeViewNode*, int> GetNodeIndexMap()
21 {
22 return Rvalue(nodeIndexMap);
23 }
24 public override void Visit(BoolNode& boolNode)
25 {
26 node.Reset(new TreeViewNode(typename(BoolNode)));
27 node->SetData(&boolNode);
28 Span span = boolNode.GetSpan();
29 lexer.ConvertExternal(span);
30 int index = span.start;
31 indexNodeMap[index] = node.Get();
32 nodeIndexMap[node.Get()] = index;
33 }
34 public override void Visit(SByteNode& sbyteNode)
35 {
36 node.Reset(new TreeViewNode(typename(SByteNode)));
37 node->SetData(&sbyteNode);
38 Span span = sbyteNode.GetSpan();
39 lexer.ConvertExternal(span);
40 int index = span.start;
41 indexNodeMap[index] = node.Get();
42 nodeIndexMap[node.Get()] = index;
43 }
44 public override void Visit(ByteNode& byteNode)
45 {
46 node.Reset(new TreeViewNode(typename(ByteNode)));
47 node->SetData(&byteNode);
48 Span span = byteNode.GetSpan();
49 lexer.ConvertExternal(span);
50 int index = span.start;
51 indexNodeMap[index] = node.Get();
52 nodeIndexMap[node.Get()] = index;
53 }
54 public override void Visit(ShortNode& shortNode)
55 {
56 node.Reset(new TreeViewNode(typename(ShortNode)));
57 node->SetData(&shortNode);
58 Span span = shortNode.GetSpan();
59 lexer.ConvertExternal(span);
60 int index = span.start;
61 indexNodeMap[index] = node.Get();
62 nodeIndexMap[node.Get()] = index;
63 }
64 public override void Visit(UShortNode& ushortNode)
65 {
66 node.Reset(new TreeViewNode(typename(UShortNode)));
67 node->SetData(&ushortNode);
68 Span span = ushortNode.GetSpan();
69 lexer.ConvertExternal(span);
70 int index = span.start;
71 indexNodeMap[index] = node.Get();
72 nodeIndexMap[node.Get()] = index;
73 }
74 public override void Visit(IntNode& intNode)
75 {
76 node.Reset(new TreeViewNode(typename(IntNode)));
77 node->SetData(&intNode);
78 Span span = intNode.GetSpan();
79 lexer.ConvertExternal(span);
80 int index = span.start;
81 indexNodeMap[index] = node.Get();
82 nodeIndexMap[node.Get()] = index;
83 }
84 public override void Visit(UIntNode& uintNode)
85 {
86 node.Reset(new TreeViewNode(typename(UIntNode)));
87 node->SetData(&uintNode);
88 Span span = uintNode.GetSpan();
89 lexer.ConvertExternal(span);
90 int index = span.start;
91 indexNodeMap[index] = node.Get();
92 nodeIndexMap[node.Get()] = index;
93 }
94 public override void Visit(LongNode& longNode)
95 {
96 node.Reset(new TreeViewNode(typename(LongNode)));
97 node->SetData(&longNode);
98 Span span = longNode.GetSpan();
99 lexer.ConvertExternal(span);
100 int index = span.start;
101 indexNodeMap[index] = node.Get();
102 nodeIndexMap[node.Get()] = index;
103 }
104 public override void Visit(ULongNode& ulongNode)
105 {
106 node.Reset(new TreeViewNode(typename(ULongNode)));
107 node->SetData(&ulongNode);
108 Span span = ulongNode.GetSpan();
109 lexer.ConvertExternal(span);
110 int index = span.start;
111 indexNodeMap[index] = node.Get();
112 nodeIndexMap[node.Get()] = index;
113 }
114 public override void Visit(FloatNode& floatNode)
115 {
116 node.Reset(new TreeViewNode(typename(FloatNode)));
117 node->SetData(&floatNode);
118 Span span = floatNode.GetSpan();
119 lexer.ConvertExternal(span);
120 int index = span.start;
121 indexNodeMap[index] = node.Get();
122 nodeIndexMap[node.Get()] = index;
123 }
124 public override void Visit(DoubleNode& doubleNode)
125 {
126 node.Reset(new TreeViewNode(typename(DoubleNode)));
127 node->SetData(&doubleNode);
128 Span span = doubleNode.GetSpan();
129 lexer.ConvertExternal(span);
130 int index = span.start;
131 indexNodeMap[index] = node.Get();
132 nodeIndexMap[node.Get()] = index;
133 }
134 public override void Visit(CharNode& charNode)
135 {
136 node.Reset(new TreeViewNode(typename(CharNode)));
137 node->SetData(&charNode);
138 Span span = charNode.GetSpan();
139 lexer.ConvertExternal(span);
140 int index = span.start;
141 indexNodeMap[index] = node.Get();
142 nodeIndexMap[node.Get()] = index;
143 }
144 public override void Visit(WCharNode& wcharNode)
145 {
146 node.Reset(new TreeViewNode(typename(WCharNode)));
147 node->SetData(&wcharNode);
148 Span span = wcharNode.GetSpan();
149 lexer.ConvertExternal(span);
150 int index = span.start;
151 indexNodeMap[index] = node.Get();
152 nodeIndexMap[node.Get()] = index;
153 }
154 public override void Visit(UCharNode& ucharNode)
155 {
156 node.Reset(new TreeViewNode(typename(UCharNode)));
157 node->SetData(&ucharNode);
158 Span span = ucharNode.GetSpan();
159 lexer.ConvertExternal(span);
160 int index = span.start;
161 indexNodeMap[index] = node.Get();
162 nodeIndexMap[node.Get()] = index;
163 }
164 public override void Visit(VoidNode& voidNode)
165 {
166 node.Reset(new TreeViewNode(typename(VoidNode)));
167 node->SetData(&voidNode);
168 Span span = voidNode.GetSpan();
169 lexer.ConvertExternal(span);
170 int index = span.start;
171 indexNodeMap[index] = node.Get();
172 nodeIndexMap[node.Get()] = index;
173 }
174 public override void Visit(BooleanLiteralNode& booleanLiteralNode)
175 {
176 node.Reset(new TreeViewNode(typename(BooleanLiteralNode)));
177 node->SetData(&booleanLiteralNode);
178 Span span = booleanLiteralNode.GetSpan();
179 lexer.ConvertExternal(span);
180 int index = span.start;
181 indexNodeMap[index] = node.Get();
182 nodeIndexMap[node.Get()] = index;
183 }
184 public override void Visit(SByteLiteralNode& sbyteLiteralNode)
185 {
186 node.Reset(new TreeViewNode(typename(SByteLiteralNode)));
187 node->SetData(&sbyteLiteralNode);
188 Span span = sbyteLiteralNode.GetSpan();
189 lexer.ConvertExternal(span);
190 int index = span.start;
191 indexNodeMap[index] = node.Get();
192 nodeIndexMap[node.Get()] = index;
193 }
194 public override void Visit(ByteLiteralNode& byteLiteralNode)
195 {
196 node.Reset(new TreeViewNode(typename(ByteLiteralNode)));
197 node->SetData(&byteLiteralNode);
198 Span span = byteLiteralNode.GetSpan();
199 lexer.ConvertExternal(span);
200 int index = span.start;
201 indexNodeMap[index] = node.Get();
202 nodeIndexMap[node.Get()] = index;
203 }
204 public override void Visit(ShortLiteralNode& shortLiteralNode)
205 {
206 node.Reset(new TreeViewNode(typename(ShortLiteralNode)));
207 node->SetData(&shortLiteralNode);
208 Span span = shortLiteralNode.GetSpan();
209 lexer.ConvertExternal(span);
210 int index = span.start;
211 indexNodeMap[index] = node.Get();
212 nodeIndexMap[node.Get()] = index;
213 }
214 public override void Visit(UShortLiteralNode& ushortLiteralNode)
215 {
216 node.Reset(new TreeViewNode(typename(UShortLiteralNode)));
217 node->SetData(&ushortLiteralNode);
218 Span span = ushortLiteralNode.GetSpan();
219 lexer.ConvertExternal(span);
220 int index = span.start;
221 indexNodeMap[index] = node.Get();
222 nodeIndexMap[node.Get()] = index;
223 }
224 public override void Visit(IntLiteralNode& intLiteralNode)
225 {
226 node.Reset(new TreeViewNode(typename(IntLiteralNode)));
227 node->SetData(&intLiteralNode);
228 Span span = intLiteralNode.GetSpan();
229 lexer.ConvertExternal(span);
230 int index = span.start;
231 indexNodeMap[index] = node.Get();
232 nodeIndexMap[node.Get()] = index;
233 }
234 public override void Visit(UIntLiteralNode& uintLiteralNode)
235 {
236 node.Reset(new TreeViewNode(typename(UIntLiteralNode)));
237 node->SetData(&uintLiteralNode);
238 Span span = uintLiteralNode.GetSpan();
239 lexer.ConvertExternal(span);
240 int index = span.start;
241 indexNodeMap[index] = node.Get();
242 nodeIndexMap[node.Get()] = index;
243 }
244 public override void Visit(LongLiteralNode& longLiteralNode)
245 {
246 node.Reset(new TreeViewNode(typename(LongLiteralNode)));
247 node->SetData(&longLiteralNode);
248 Span span = longLiteralNode.GetSpan();
249 lexer.ConvertExternal(span);
250 int index = span.start;
251 indexNodeMap[index] = node.Get();
252 nodeIndexMap[node.Get()] = index;
253 }
254 public override void Visit(ULongLiteralNode& ulongLiteralNode)
255 {
256 node.Reset(new TreeViewNode(typename(ULongLiteralNode)));
257 node->SetData(&ulongLiteralNode);
258 Span span = ulongLiteralNode.GetSpan();
259 lexer.ConvertExternal(span);
260 int index = span.start;
261 indexNodeMap[index] = node.Get();
262 nodeIndexMap[node.Get()] = index;
263 }
264 public override void Visit(FloatLiteralNode& floatLiteralNode)
265 {
266 node.Reset(new TreeViewNode(typename(FloatLiteralNode)));
267 node->SetData(&floatLiteralNode);
268 Span span = floatLiteralNode.GetSpan();
269 lexer.ConvertExternal(span);
270 int index = span.start;
271 indexNodeMap[index] = node.Get();
272 nodeIndexMap[node.Get()] = index;
273 }
274 public override void Visit(DoubleLiteralNode& doubleLiteralNode)
275 {
276 node.Reset(new TreeViewNode(typename(DoubleLiteralNode)));
277 node->SetData(&doubleLiteralNode);
278 Span span = doubleLiteralNode.GetSpan();
279 lexer.ConvertExternal(span);
280 int index = span.start;
281 indexNodeMap[index] = node.Get();
282 nodeIndexMap[node.Get()] = index;
283 }
284 public override void Visit(CharLiteralNode& charLiteralNode)
285 {
286 node.Reset(new TreeViewNode(typename(CharLiteralNode)));
287 node->SetData(&charLiteralNode);
288 Span span = charLiteralNode.GetSpan();
289 lexer.ConvertExternal(span);
290 int index = span.start;
291 indexNodeMap[index] = node.Get();
292 nodeIndexMap[node.Get()] = index;
293 }
294 public override void Visit(WCharLiteralNode& wcharLiteralNode)
295 {
296 node.Reset(new TreeViewNode(typename(WCharLiteralNode)));
297 node->SetData(&wcharLiteralNode);
298 Span span = wcharLiteralNode.GetSpan();
299 lexer.ConvertExternal(span);
300 int index = span.start;
301 indexNodeMap[index] = node.Get();
302 nodeIndexMap[node.Get()] = index;
303 }
304 public override void Visit(UCharLiteralNode& ucharLiteralNode)
305 {
306 node.Reset(new TreeViewNode(typename(UCharLiteralNode)));
307 node->SetData(&ucharLiteralNode);
308 Span span = ucharLiteralNode.GetSpan();
309 lexer.ConvertExternal(span);
310 int index = span.start;
311 indexNodeMap[index] = node.Get();
312 nodeIndexMap[node.Get()] = index;
313 }
314 public override void Visit(StringLiteralNode& stringLiteralNode)
315 {
316 node.Reset(new TreeViewNode(typename(StringLiteralNode)));
317 node->SetData(&stringLiteralNode);
318 Span span = stringLiteralNode.GetSpan();
319 lexer.ConvertExternal(span);
320 int index = span.start;
321 indexNodeMap[index] = node.Get();
322 nodeIndexMap[node.Get()] = index;
323 }
324 public override void Visit(WStringLiteralNode& wstringLiteralNode)
325 {
326 node.Reset(new TreeViewNode(typename(WStringLiteralNode)));
327 node->SetData(&wstringLiteralNode);
328 Span span = wstringLiteralNode.GetSpan();
329 lexer.ConvertExternal(span);
330 int index = span.start;
331 indexNodeMap[index] = node.Get();
332 nodeIndexMap[node.Get()] = index;
333 }
334 public override void Visit(UStringLiteralNode& ustringLiteralNode)
335 {
336 node.Reset(new TreeViewNode(typename(UStringLiteralNode)));
337 node->SetData(&ustringLiteralNode);
338 Span span = ustringLiteralNode.GetSpan();
339 lexer.ConvertExternal(span);
340 int index = span.start;
341 indexNodeMap[index] = node.Get();
342 nodeIndexMap[node.Get()] = index;
343 }
344 public override void Visit(NullLiteralNode& nullLiteralNode)
345 {
346 node.Reset(new TreeViewNode(typename(NullLiteralNode)));
347 node->SetData(&nullLiteralNode);
348 Span span = nullLiteralNode.GetSpan();
349 lexer.ConvertExternal(span);
350 int index = span.start;
351 indexNodeMap[index] = node.Get();
352 nodeIndexMap[node.Get()] = index;
353 }
354 public override void Visit(ArrayLiteralNode& arrayLiteralNode)
355 {
356 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ArrayLiteralNode)));
357 int n = arrayLiteralNode.Values().Count();
358 for (int i = 0; i < n; ++i;)
359 {
360 arrayLiteralNode.Values()[i]->Accept(*this);
361 treeViewNode->AddChild(node.Release());
362 }
363 node.Reset(treeViewNode.Release());
364 node->SetData(&arrayLiteralNode);
365 Span span = arrayLiteralNode.GetSpan();
366 lexer.ConvertExternal(span);
367 int index = span.start;
368 indexNodeMap[index] = node.Get();
369 nodeIndexMap[node.Get()] = index;
370 }
371 public override void Visit(StructuredLiteralNode& structuredLiteralNode)
372 {
373 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(StructuredLiteralNode)));
374 int n = structuredLiteralNode.Members().Count();
375 for (int i = 0; i < n; ++i;)
376 {
377 structuredLiteralNode.Members()[i]->Accept(*this);
378 treeViewNode->AddChild(node.Release());
379 }
380 node.Reset(treeViewNode.Release());
381 node->SetData(&structuredLiteralNode);
382 Span span = structuredLiteralNode.GetSpan();
383 lexer.ConvertExternal(span);
384 int index = span.start;
385 indexNodeMap[index] = node.Get();
386 nodeIndexMap[node.Get()] = index;
387 }
388 public override void Visit(UuidLiteralNode& uuidLiteralNode)
389 {
390 node.Reset(new TreeViewNode(typename(UuidLiteralNode)));
391 node->SetData(&uuidLiteralNode);
392 Span span = uuidLiteralNode.GetSpan();
393 lexer.ConvertExternal(span);
394 int index = span.start;
395 indexNodeMap[index] = node.Get();
396 nodeIndexMap[node.Get()] = index;
397 }
398 public override void Visit(CompileUnitNode& compileUnitNode)
399 {
400 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CompileUnitNode)));
401 compileUnitNode.GlobalNs()->Accept(*this);
402 treeViewNode->AddChild(node.Release());
403 node.Reset(treeViewNode.Release());
404 node->SetData(&compileUnitNode);
405 Span span = compileUnitNode.GetSpan();
406 lexer.ConvertExternal(span);
407 int index = span.start;
408 indexNodeMap[index] = node.Get();
409 nodeIndexMap[node.Get()] = index;
410 }
411 public override void Visit(NamespaceNode& namespaceNode)
412 {
413 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(NamespaceNode)));
414 if (namespaceNode.Id() != null)
415 {
416 namespaceNode.Id()->Accept(*this);
417 treeViewNode->AddChild(node.Release());
418 }
419 int n = namespaceNode.Members().Count();
420 for (int i = 0; i < n; ++i;)
421 {
422 namespaceNode.Members()[i]->Accept(*this);
423 treeViewNode->AddChild(node.Release());
424 }
425 node.Reset(treeViewNode.Release());
426 node->SetData(&namespaceNode);
427 Span span = namespaceNode.GetSpan();
428 lexer.ConvertExternal(span);
429 int index = span.start;
430 indexNodeMap[index] = node.Get();
431 nodeIndexMap[node.Get()] = index;
432 }
433 public override void Visit(AliasNode& aliasNode)
434 {
435 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AliasNode)));
436 aliasNode.Id()->Accept(*this);
437 treeViewNode->AddChild(node.Release());
438 aliasNode.Qid()->Accept(*this);
439 treeViewNode->AddChild(node.Release());
440 node.Reset(treeViewNode.Release());
441 node->SetData(&aliasNode);
442 Span span = aliasNode.GetSpan();
443 lexer.ConvertExternal(span);
444 int index = span.start;
445 indexNodeMap[index] = node.Get();
446 nodeIndexMap[node.Get()] = index;
447 }
448 public override void Visit(NamespaceImportNode& namespaceImportNode)
449 {
450 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(NamespaceImportNode)));
451 namespaceImportNode.Ns()->Accept(*this);
452 treeViewNode->AddChild(node.Release());
453 node.Reset(treeViewNode.Release());
454 node->SetData(&namespaceImportNode);
455 Span span = namespaceImportNode.GetSpan();
456 lexer.ConvertExternal(span);
457 int index = span.start;
458 indexNodeMap[index] = node.Get();
459 nodeIndexMap[node.Get()] = index;
460 }
461 public override void Visit(IdentifierNode& identifierNode)
462 {
463 node.Reset(new TreeViewNode(typename(IdentifierNode)));
464 node->SetData(&identifierNode);
465 Span span = identifierNode.GetSpan();
466 lexer.ConvertExternal(span);
467 int index = span.start;
468 indexNodeMap[index] = node.Get();
469 nodeIndexMap[node.Get()] = index;
470 }
471 public override void Visit(TemplateIdNode& templateIdNode)
472 {
473 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TemplateIdNode)));
474 templateIdNode.Primary()->Accept(*this);
475 treeViewNode->AddChild(node.Release());
476 int n = templateIdNode.TemplateArguments().Count();
477 for (int i = 0; i < n; ++i;)
478 {
479 templateIdNode.TemplateArguments()[i]->Accept(*this);
480 treeViewNode->AddChild(node.Release());
481 }
482 node.Reset(treeViewNode.Release());
483 node->SetData(&templateIdNode);
484 Span span = templateIdNode.GetSpan();
485 lexer.ConvertExternal(span);
486 int index = span.start;
487 indexNodeMap[index] = node.Get();
488 nodeIndexMap[node.Get()] = index;
489 }
490 public override void Visit(FunctionNode& functionNode)
491 {
492 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(FunctionNode)));
493 if (functionNode.GetAttributes() != null)
494 {
495 functionNode.GetAttributes()->Accept(*this);
496 treeViewNode->AddChild(node.Release());
497 }
498 functionNode.ReturnTypeExpr()->Accept(*this);
499 treeViewNode->AddChild(node.Release());
500 int nt = functionNode.TemplateParameters().Count();
501 for (int i = 0; i < nt; ++i;)
502 {
503 functionNode.TemplateParameters()[i]->Accept(*this);
504 treeViewNode->AddChild(node.Release());
505 }
506 int np = functionNode.Parameters().Count();
507 for (int i = 0; i < np; ++i;)
508 {
509 functionNode.Parameters()[i]->Accept(*this);
510 treeViewNode->AddChild(node.Release());
511 }
512 if (functionNode.WhereConstraint() != null)
513 {
514 functionNode.WhereConstraint()->Accept(*this);
515 treeViewNode->AddChild(node.Release());
516 }
517 if (functionNode.Body() != null)
518 {
519 functionNode.Body()->Accept(*this);
520 treeViewNode->AddChild(node.Release());
521 }
522 node.Reset(treeViewNode.Release());
523 node->SetData(&functionNode);
524 Span span = functionNode.GetSpan();
525 lexer.ConvertExternal(span);
526 int index = span.start;
527 indexNodeMap[index] = node.Get();
528 nodeIndexMap[node.Get()] = index;
529 }
530 public override void Visit(ClassNode& classNode)
531 {
532 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ClassNode)));
533 if (classNode.GetAttributes() != null)
534 {
535 classNode.GetAttributes()->Accept(*this);
536 treeViewNode->AddChild(node.Release());
537 }
538 classNode.Id()->Accept(*this);
539 treeViewNode->AddChild(node.Release());
540 int nt = classNode.TemplateParameters().Count();
541 for (int i = 0; i < nt; ++i;)
542 {
543 classNode.TemplateParameters()[i]->Accept(*this);
544 treeViewNode->AddChild(node.Release());
545 }
546 int nb = classNode.BaseClassOrInterfaces().Count();
547 for (int i = 0; i < nb; ++i;)
548 {
549 classNode.BaseClassOrInterfaces()[i]->Accept(*this);
550 treeViewNode->AddChild(node.Release());
551 }
552 if (classNode.WhereConstraint() != null)
553 {
554 classNode.WhereConstraint()->Accept(*this);
555 treeViewNode->AddChild(node.Release());
556 }
557 int nm = classNode.Members().Count();
558 for (int i = 0; i < nm; ++i;)
559 {
560 classNode.Members()[i]->Accept(*this);
561 treeViewNode->AddChild(node.Release());
562 }
563 node.Reset(treeViewNode.Release());
564 node->SetData(&classNode);
565 Span span = classNode.GetSpan();
566 lexer.ConvertExternal(span);
567 int index = span.start;
568 indexNodeMap[index] = node.Get();
569 nodeIndexMap[node.Get()] = index;
570 }
571 public override void Visit(ThisInitializerNode& thisInitializerNode)
572 {
573 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ThisInitializerNode)));
574 int na = thisInitializerNode.Arguments().Count();
575 for (int i = 0; i < na; ++i;)
576 {
577 thisInitializerNode.Arguments()[i]->Accept(*this);
578 treeViewNode->AddChild(node.Release());
579 }
580 node.Reset(treeViewNode.Release());
581 node->SetData(&thisInitializerNode);
582 Span span = thisInitializerNode.GetSpan();
583 lexer.ConvertExternal(span);
584 int index = span.start;
585 indexNodeMap[index] = node.Get();
586 nodeIndexMap[node.Get()] = index;
587 }
588 public override void Visit(BaseInitializerNode& baseInitializerNode)
589 {
590 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(BaseInitializerNode)));
591 int na = baseInitializerNode.Arguments().Count();
592 for (int i = 0; i < na; ++i;)
593 {
594 baseInitializerNode.Arguments()[i]->Accept(*this);
595 treeViewNode->AddChild(node.Release());
596 }
597 node.Reset(treeViewNode.Release());
598 node->SetData(&baseInitializerNode);
599 Span span = baseInitializerNode.GetSpan();
600 lexer.ConvertExternal(span);
601 int index = span.start;
602 indexNodeMap[index] = node.Get();
603 nodeIndexMap[node.Get()] = index;
604 }
605 public override void Visit(MemberInitializerNode& memberInitializerNode)
606 {
607 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(MemberInitializerNode)));
608 memberInitializerNode.MemberId()->Accept(*this);
609 treeViewNode->AddChild(node.Release());
610 int na = memberInitializerNode.Arguments().Count();
611 for (int i = 0; i < na; ++i;)
612 {
613 memberInitializerNode.Arguments()[i]->Accept(*this);
614 treeViewNode->AddChild(node.Release());
615 }
616 node.Reset(treeViewNode.Release());
617 node->SetData(&memberInitializerNode);
618 Span span = memberInitializerNode.GetSpan();
619 lexer.ConvertExternal(span);
620 int index = span.start;
621 indexNodeMap[index] = node.Get();
622 nodeIndexMap[node.Get()] = index;
623 }
624 public override void Visit(StaticConstructorNode& staticConstructorNode)
625 {
626 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(StaticConstructorNode)));
627 if (staticConstructorNode.GetAttributes() != null)
628 {
629 staticConstructorNode.GetAttributes()->Accept(*this);
630 treeViewNode->AddChild(node.Release());
631 }
632 staticConstructorNode.ClassId()->Accept(*this);
633 treeViewNode->AddChild(node.Release());
634 int ni = staticConstructorNode.Initializers().Count();
635 for (int i = 0; i < ni; ++i;)
636 {
637 staticConstructorNode.Initializers()[i]->Accept(*this);
638 treeViewNode->AddChild(node.Release());
639 }
640 if (staticConstructorNode.WhereConstraint() != null)
641 {
642 staticConstructorNode.WhereConstraint()->Accept(*this);
643 treeViewNode->AddChild(node.Release());
644 }
645 if (staticConstructorNode.Body() != null)
646 {
647 staticConstructorNode.Body()->Accept(*this);
648 treeViewNode->AddChild(node.Release());
649 }
650 node.Reset(treeViewNode.Release());
651 node->SetData(&staticConstructorNode);
652 Span span = staticConstructorNode.GetSpan();
653 lexer.ConvertExternal(span);
654 int index = span.start;
655 indexNodeMap[index] = node.Get();
656 nodeIndexMap[node.Get()] = index;
657 }
658 public override void Visit(ConstructorNode& constructorNode)
659 {
660 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConstructorNode)));
661 if (constructorNode.GetAttributes() != null)
662 {
663 constructorNode.GetAttributes()->Accept(*this);
664 treeViewNode->AddChild(node.Release());
665 }
666 constructorNode.ClassId()->Accept(*this);
667 treeViewNode->AddChild(node.Release());
668 int np = constructorNode.Parameters().Count();
669 for (int i = 0; i < np; ++i;)
670 {
671 constructorNode.Parameters()[i]->Accept(*this);
672 treeViewNode->AddChild(node.Release());
673 }
674 int ni = constructorNode.Initializers().Count();
675 for (int i = 0; i < ni; ++i;)
676 {
677 constructorNode.Initializers()[i]->Accept(*this);
678 treeViewNode->AddChild(node.Release());
679 }
680 if (constructorNode.WhereConstraint() != null)
681 {
682 constructorNode.WhereConstraint()->Accept(*this);
683 treeViewNode->AddChild(node.Release());
684 }
685 if (constructorNode.Body() != null)
686 {
687 constructorNode.Body()->Accept(*this);
688 treeViewNode->AddChild(node.Release());
689 }
690 node.Reset(treeViewNode.Release());
691 node->SetData(&constructorNode);
692 Span span = constructorNode.GetSpan();
693 lexer.ConvertExternal(span);
694 int index = span.start;
695 indexNodeMap[index] = node.Get();
696 nodeIndexMap[node.Get()] = index;
697 }
698 public override void Visit(DestructorNode& destructorNode)
699 {
700 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DestructorNode)));
701 if (destructorNode.GetAttributes() != null)
702 {
703 destructorNode.GetAttributes()->Accept(*this);
704 treeViewNode->AddChild(node.Release());
705 }
706 destructorNode.ClassId()->Accept(*this);
707 treeViewNode->AddChild(node.Release());
708 if (destructorNode.WhereConstraint() != null)
709 {
710 destructorNode.WhereConstraint()->Accept(*this);
711 treeViewNode->AddChild(node.Release());
712 }
713 if (destructorNode.Body() != null)
714 {
715 destructorNode.Body()->Accept(*this);
716 treeViewNode->AddChild(node.Release());
717 }
718 node.Reset(treeViewNode.Release());
719 node->SetData(&destructorNode);
720 Span span = destructorNode.GetSpan();
721 lexer.ConvertExternal(span);
722 int index = span.start;
723 indexNodeMap[index] = node.Get();
724 nodeIndexMap[node.Get()] = index;
725 }
726 public override void Visit(MemberFunctionNode& memberFunctionNode)
727 {
728 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(MemberFunctionNode)));
729 if (memberFunctionNode.GetAttributes() != null)
730 {
731 memberFunctionNode.GetAttributes()->Accept(*this);
732 treeViewNode->AddChild(node.Release());
733 }
734 memberFunctionNode.ReturnTypeExpr()->Accept(*this);
735 treeViewNode->AddChild(node.Release());
736 int np = memberFunctionNode.Parameters().Count();
737 for (int i = 0; i < np; ++i;)
738 {
739 memberFunctionNode.Parameters()[i]->Accept(*this);
740 treeViewNode->AddChild(node.Release());
741 }
742 if (memberFunctionNode.WhereConstraint() != null)
743 {
744 memberFunctionNode.WhereConstraint()->Accept(*this);
745 treeViewNode->AddChild(node.Release());
746 }
747 if (memberFunctionNode.Body() != null)
748 {
749 memberFunctionNode.Body()->Accept(*this);
750 treeViewNode->AddChild(node.Release());
751 }
752 node.Reset(treeViewNode.Release());
753 node->SetData(&memberFunctionNode);
754 Span span = memberFunctionNode.GetSpan();
755 lexer.ConvertExternal(span);
756 int index = span.start;
757 indexNodeMap[index] = node.Get();
758 nodeIndexMap[node.Get()] = index;
759 }
760 public override void Visit(ConversionFunctionNode& conversionFunctionNode)
761 {
762 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConversionFunctionNode)));
763 if (conversionFunctionNode.GetAttributes() != null)
764 {
765 conversionFunctionNode.GetAttributes()->Accept(*this);
766 treeViewNode->AddChild(node.Release());
767 }
768 conversionFunctionNode.ReturnTypeExpr()->Accept(*this);
769 treeViewNode->AddChild(node.Release());
770 if (conversionFunctionNode.WhereConstraint() != null)
771 {
772 conversionFunctionNode.WhereConstraint()->Accept(*this);
773 treeViewNode->AddChild(node.Release());
774 }
775 if (conversionFunctionNode.Body() != null)
776 {
777 conversionFunctionNode.Body()->Accept(*this);
778 treeViewNode->AddChild(node.Release());
779 }
780 node.Reset(treeViewNode.Release());
781 node->SetData(&conversionFunctionNode);
782 Span span = conversionFunctionNode.GetSpan();
783 lexer.ConvertExternal(span);
784 int index = span.start;
785 indexNodeMap[index] = node.Get();
786 nodeIndexMap[node.Get()] = index;
787 }
788 public override void Visit(MemberVariableNode& memberVariableNode)
789 {
790 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(MemberVariableNode)));
791 if (memberVariableNode.GetAttributes() != null)
792 {
793 memberVariableNode.GetAttributes()->Accept(*this);
794 treeViewNode->AddChild(node.Release());
795 }
796 memberVariableNode.TypeExpr()->Accept(*this);
797 treeViewNode->AddChild(node.Release());
798 memberVariableNode.Id()->Accept(*this);
799 treeViewNode->AddChild(node.Release());
800 node.Reset(treeViewNode.Release());
801 node->SetData(&memberVariableNode);
802 Span span = memberVariableNode.GetSpan();
803 lexer.ConvertExternal(span);
804 int index = span.start;
805 indexNodeMap[index] = node.Get();
806 nodeIndexMap[node.Get()] = index;
807 }
808 public override void Visit(InterfaceNode& interfaceNode)
809 {
810 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(InterfaceNode)));
811 if (interfaceNode.GetAttributes() != null)
812 {
813 interfaceNode.GetAttributes()->Accept(*this);
814 treeViewNode->AddChild(node.Release());
815 }
816 interfaceNode.Id()->Accept(*this);
817 treeViewNode->AddChild(node.Release());
818 int nm = interfaceNode.Members().Count();
819 for (int i = 0; i < nm; ++i;)
820 {
821 interfaceNode.Members()[i]->Accept(*this);
822 treeViewNode->AddChild(node.Release());
823 }
824 node.Reset(treeViewNode.Release());
825 node->SetData(&interfaceNode);
826 Span span = interfaceNode.GetSpan();
827 lexer.ConvertExternal(span);
828 int index = span.start;
829 indexNodeMap[index] = node.Get();
830 nodeIndexMap[node.Get()] = index;
831 }
832 public override void Visit(DelegateNode& delegateNode)
833 {
834 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DelegateNode)));
835 delegateNode.ReturnTypeExpr()->Accept(*this);
836 treeViewNode->AddChild(node.Release());
837 delegateNode.Id()->Accept(*this);
838 treeViewNode->AddChild(node.Release());
839 int np = delegateNode.Parameters().Count();
840 for (int i = 0; i < np; ++i;)
841 {
842 delegateNode.Parameters()[i]->Accept(*this);
843 treeViewNode->AddChild(node.Release());
844 }
845 node.Reset(treeViewNode.Release());
846 node->SetData(&delegateNode);
847 Span span = delegateNode.GetSpan();
848 lexer.ConvertExternal(span);
849 int index = span.start;
850 indexNodeMap[index] = node.Get();
851 nodeIndexMap[node.Get()] = index;
852 }
853 public override void Visit(ClassDelegateNode& classDelegateNode)
854 {
855 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ClassDelegateNode)));
856 classDelegateNode.ReturnTypeExpr()->Accept(*this);
857 treeViewNode->AddChild(node.Release());
858 classDelegateNode.Id()->Accept(*this);
859 treeViewNode->AddChild(node.Release());
860 int np = classDelegateNode.Parameters().Count();
861 for (int i = 0; i < np; ++i;)
862 {
863 classDelegateNode.Parameters()[i]->Accept(*this);
864 treeViewNode->AddChild(node.Release());
865 }
866 node.Reset(treeViewNode.Release());
867 node->SetData(&classDelegateNode);
868 Span span = classDelegateNode.GetSpan();
869 lexer.ConvertExternal(span);
870 int index = span.start;
871 indexNodeMap[index] = node.Get();
872 nodeIndexMap[node.Get()] = index;
873 }
874 public override void Visit(ParenthesizedConstraintNode& parenthesizedConstraintNode)
875 {
876 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ParenthesizedConstraintNode)));
877 parenthesizedConstraintNode.Constraint()->Accept(*this);
878 treeViewNode->AddChild(node.Release());
879 node.Reset(treeViewNode.Release());
880 node->SetData(&parenthesizedConstraintNode);
881 Span span = parenthesizedConstraintNode.GetSpan();
882 lexer.ConvertExternal(span);
883 int index = span.start;
884 indexNodeMap[index] = node.Get();
885 nodeIndexMap[node.Get()] = index;
886 }
887 public override void Visit(DisjunctiveConstraintNode& disjunctiveConstraintNode)
888 {
889 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DisjunctiveConstraintNode)));
890 disjunctiveConstraintNode.Left()->Accept(*this);
891 treeViewNode->AddChild(node.Release());
892 disjunctiveConstraintNode.Right()->Accept(*this);
893 treeViewNode->AddChild(node.Release());
894 node.Reset(treeViewNode.Release());
895 node->SetData(&disjunctiveConstraintNode);
896 Span span = disjunctiveConstraintNode.GetSpan();
897 lexer.ConvertExternal(span);
898 int index = span.start;
899 indexNodeMap[index] = node.Get();
900 nodeIndexMap[node.Get()] = index;
901 }
902 public override void Visit(ConjunctiveConstraintNode& conjunctiveConstraintNode)
903 {
904 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConjunctiveConstraintNode)));
905 conjunctiveConstraintNode.Left()->Accept(*this);
906 treeViewNode->AddChild(node.Release());
907 conjunctiveConstraintNode.Right()->Accept(*this);
908 treeViewNode->AddChild(node.Release());
909 node.Reset(treeViewNode.Release());
910 node->SetData(&conjunctiveConstraintNode);
911 Span span = conjunctiveConstraintNode.GetSpan();
912 lexer.ConvertExternal(span);
913 int index = span.start;
914 indexNodeMap[index] = node.Get();
915 nodeIndexMap[node.Get()] = index;
916 }
917 public override void Visit(WhereConstraintNode& whereConstraintNode)
918 {
919 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(WhereConstraintNode)));
920 whereConstraintNode.Constraint()->Accept(*this);
921 treeViewNode->AddChild(node.Release());
922 node.Reset(treeViewNode.Release());
923 node->SetData(&whereConstraintNode);
924 Span span = whereConstraintNode.GetSpan();
925 lexer.ConvertExternal(span);
926 int index = span.start;
927 indexNodeMap[index] = node.Get();
928 nodeIndexMap[node.Get()] = index;
929 }
930 public override void Visit(PredicateConstraintNode& predicateConstraintNode)
931 {
932 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(PredicateConstraintNode)));
933 predicateConstraintNode.InvokeExpr()->Accept(*this);
934 treeViewNode->AddChild(node.Release());
935 node.Reset(treeViewNode.Release());
936 node->SetData(&predicateConstraintNode);
937 Span span = predicateConstraintNode.GetSpan();
938 lexer.ConvertExternal(span);
939 int index = span.start;
940 indexNodeMap[index] = node.Get();
941 nodeIndexMap[node.Get()] = index;
942 }
943 public override void Visit(IsConstraintNode& isConstraintNode)
944 {
945 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(IsConstraintNode)));
946 isConstraintNode.TypeExpr()->Accept(*this);
947 treeViewNode->AddChild(node.Release());
948 isConstraintNode.ConceptOrTypeName()->Accept(*this);
949 treeViewNode->AddChild(node.Release());
950 node.Reset(treeViewNode.Release());
951 node->SetData(&isConstraintNode);
952 Span span = isConstraintNode.GetSpan();
953 lexer.ConvertExternal(span);
954 int index = span.start;
955 indexNodeMap[index] = node.Get();
956 nodeIndexMap[node.Get()] = index;
957 }
958 public override void Visit(MultiParamConstraintNode& multiParamConstraintNode)
959 {
960 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(MultiParamConstraintNode)));
961 multiParamConstraintNode.ConceptId()->Accept(*this);
962 treeViewNode->AddChild(node.Release());
963 int nt = multiParamConstraintNode.TypeExprs().Count();
964 for (int i = 0; i < nt; ++i;)
965 {
966 multiParamConstraintNode.TypeExprs()[i]->Accept(*this);
967 treeViewNode->AddChild(node.Release());
968 }
969 node.Reset(treeViewNode.Release());
970 node->SetData(&multiParamConstraintNode);
971 Span span = multiParamConstraintNode.GetSpan();
972 lexer.ConvertExternal(span);
973 int index = span.start;
974 indexNodeMap[index] = node.Get();
975 nodeIndexMap[node.Get()] = index;
976 }
977 public override void Visit(TypeNameConstraintNode& typeNameConstraintNode)
978 {
979 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TypeNameConstraintNode)));
980 typeNameConstraintNode.TypeId()->Accept(*this);
981 treeViewNode->AddChild(node.Release());
982 node.Reset(treeViewNode.Release());
983 node->SetData(&typeNameConstraintNode);
984 Span span = typeNameConstraintNode.GetSpan();
985 lexer.ConvertExternal(span);
986 int index = span.start;
987 indexNodeMap[index] = node.Get();
988 nodeIndexMap[node.Get()] = index;
989 }
990 public override void Visit(ConstructorConstraintNode& constructorConstraintNode)
991 {
992 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConstructorConstraintNode)));
993 constructorConstraintNode.TypeParamId()->Accept(*this);
994 treeViewNode->AddChild(node.Release());
995 int np = constructorConstraintNode.Parameters().Count();
996 for (int i = 0; i < np; ++i;)
997 {
998 constructorConstraintNode.Parameters()[i]->Accept(*this);
999 treeViewNode->AddChild(node.Release());
1000 }
1001 node.Reset(treeViewNode.Release());
1002 node->SetData(&constructorConstraintNode);
1003 Span span = constructorConstraintNode.GetSpan();
1004 lexer.ConvertExternal(span);
1005 int index = span.start;
1006 indexNodeMap[index] = node.Get();
1007 nodeIndexMap[node.Get()] = index;
1008 }
1009 public override void Visit(DestructorConstraintNode& destructorConstraintNode)
1010 {
1011 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DestructorConstraintNode)));
1012 destructorConstraintNode.TypeParamId()->Accept(*this);
1013 treeViewNode->AddChild(node.Release());
1014 node.Reset(treeViewNode.Release());
1015 node->SetData(&destructorConstraintNode);
1016 Span span = destructorConstraintNode.GetSpan();
1017 lexer.ConvertExternal(span);
1018 int index = span.start;
1019 indexNodeMap[index] = node.Get();
1020 nodeIndexMap[node.Get()] = index;
1021 }
1022 public override void Visit(MemberFunctionConstraintNode& memberFunctionConstraintNode)
1023 {
1024 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(MemberFunctionConstraintNode)));
1025 memberFunctionConstraintNode.ReturnTypeExpr()->Accept(*this);
1026 treeViewNode->AddChild(node.Release());
1027 memberFunctionConstraintNode.TypeParamId()->Accept(*this);
1028 treeViewNode->AddChild(node.Release());
1029 int np = memberFunctionConstraintNode.Parameters().Count();
1030 for (int i = 0; i < np; ++i;)
1031 {
1032 memberFunctionConstraintNode.Parameters()[i]->Accept(*this);
1033 treeViewNode->AddChild(node.Release());
1034 }
1035 node.Reset(treeViewNode.Release());
1036 node->SetData(&memberFunctionConstraintNode);
1037 Span span = memberFunctionConstraintNode.GetSpan();
1038 lexer.ConvertExternal(span);
1039 int index = span.start;
1040 indexNodeMap[index] = node.Get();
1041 nodeIndexMap[node.Get()] = index;
1042 }
1043 public override void Visit(FunctionConstraintNode& functionConstraintNode)
1044 {
1045 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(FunctionConstraintNode)));
1046 functionConstraintNode.ReturnTypeExpr()->Accept(*this);
1047 treeViewNode->AddChild(node.Release());
1048 int np = functionConstraintNode.Parameters().Count();
1049 for (int i = 0; i < np; ++i;)
1050 {
1051 functionConstraintNode.Parameters()[i]->Accept(*this);
1052 treeViewNode->AddChild(node.Release());
1053 }
1054 node.Reset(treeViewNode.Release());
1055 node->SetData(&functionConstraintNode);
1056 Span span = functionConstraintNode.GetSpan();
1057 lexer.ConvertExternal(span);
1058 int index = span.start;
1059 indexNodeMap[index] = node.Get();
1060 nodeIndexMap[node.Get()] = index;
1061 }
1062 public override void Visit(AxiomStatementNode& axiomStatementNode)
1063 {
1064 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AxiomStatementNode)));
1065 axiomStatementNode.Expression()->Accept(*this);
1066 treeViewNode->AddChild(node.Release());
1067 node.Reset(treeViewNode.Release());
1068 node->SetData(&axiomStatementNode);
1069 Span span = axiomStatementNode.GetSpan();
1070 lexer.ConvertExternal(span);
1071 int index = span.start;
1072 indexNodeMap[index] = node.Get();
1073 nodeIndexMap[node.Get()] = index;
1074 }
1075 public override void Visit(AxiomNode& axiomNode)
1076 {
1077 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AxiomNode)));
1078 if (axiomNode.Id() != null)
1079 {
1080 axiomNode.Id()->Accept(*this);
1081 treeViewNode->AddChild(node.Release());
1082 }
1083 int np = axiomNode.Parameters().Count();
1084 for (int i = 0; i < np; ++i;)
1085 {
1086 axiomNode.Parameters()[i]->Accept(*this);
1087 treeViewNode->AddChild(node.Release());
1088 }
1089 int ns = axiomNode.Statements().Count();
1090 for (int i = 0; i < ns; ++i;)
1091 {
1092 axiomNode.Statements()[i]->Accept(*this);
1093 treeViewNode->AddChild(node.Release());
1094 }
1095 node.Reset(treeViewNode.Release());
1096 node->SetData(&axiomNode);
1097 Span span = axiomNode.GetSpan();
1098 lexer.ConvertExternal(span);
1099 int index = span.start;
1100 indexNodeMap[index] = node.Get();
1101 nodeIndexMap[node.Get()] = index;
1102 }
1103 public override void Visit(ConceptIdNode& conceptIdNode)
1104 {
1105 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConceptIdNode)));
1106 conceptIdNode.Id()->Accept(*this);
1107 treeViewNode->AddChild(node.Release());
1108 int np = conceptIdNode.TypeParameters().Count();
1109 for (int i = 0; i < np; ++i;)
1110 {
1111 conceptIdNode.TypeParameters()[i]->Accept(*this);
1112 treeViewNode->AddChild(node.Release());
1113 }
1114 node.Reset(treeViewNode.Release());
1115 node->SetData(&conceptIdNode);
1116 Span span = conceptIdNode.GetSpan();
1117 lexer.ConvertExternal(span);
1118 int index = span.start;
1119 indexNodeMap[index] = node.Get();
1120 nodeIndexMap[node.Get()] = index;
1121 }
1122 public override void Visit(ConceptNode& conceptNode)
1123 {
1124 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConceptNode)));
1125 conceptNode.Id()->Accept(*this);
1126 int np = conceptNode.TypeParameters().Count();
1127 for (int i = 0; i < np; ++i;)
1128 {
1129 conceptNode.TypeParameters()[i]->Accept(*this);
1130 treeViewNode->AddChild(node.Release());
1131 }
1132 if (conceptNode.Refinement() != null)
1133 {
1134 conceptNode.Refinement()->Accept(*this);
1135 treeViewNode->AddChild(node.Release());
1136 }
1137 int nc = conceptNode.Constraints().Count();
1138 for (int i = 0; i < nc; ++i;)
1139 {
1140 conceptNode.Constraints()[i]->Accept(*this);
1141 treeViewNode->AddChild(node.Release());
1142 }
1143 int na = conceptNode.Axioms().Count();
1144 for (int i = 0; i < na; ++i;)
1145 {
1146 conceptNode.Axioms()[i]->Accept(*this);
1147 treeViewNode->AddChild(node.Release());
1148 }
1149 node.Reset(treeViewNode.Release());
1150 node->SetData(&conceptNode);
1151 Span span = conceptNode.GetSpan();
1152 lexer.ConvertExternal(span);
1153 int index = span.start;
1154 indexNodeMap[index] = node.Get();
1155 nodeIndexMap[node.Get()] = index;
1156 }
1157 public override void Visit(SameConstraintNode& sameConstraintNode)
1158 {
1159 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(SameConstraintNode)));
1160 node.Reset(treeViewNode.Release());
1161 node->SetData(&sameConstraintNode);
1162 Span span = sameConstraintNode.GetSpan();
1163 lexer.ConvertExternal(span);
1164 int index = span.start;
1165 indexNodeMap[index] = node.Get();
1166 nodeIndexMap[node.Get()] = index;
1167 }
1168 public override void Visit(DerivedConstraintNode& derivedConstraintNode)
1169 {
1170 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DerivedConstraintNode)));
1171 node.Reset(treeViewNode.Release());
1172 node->SetData(&derivedConstraintNode);
1173 Span span = derivedConstraintNode.GetSpan();
1174 lexer.ConvertExternal(span);
1175 int index = span.start;
1176 indexNodeMap[index] = node.Get();
1177 nodeIndexMap[node.Get()] = index;
1178 }
1179 public override void Visit(ConvertibleConstraintNode& convertibleConstraintNode)
1180 {
1181 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConvertibleConstraintNode)));
1182 node.Reset(treeViewNode.Release());
1183 node->SetData(&convertibleConstraintNode);
1184 Span span = convertibleConstraintNode.GetSpan();
1185 lexer.ConvertExternal(span);
1186 int index = span.start;
1187 indexNodeMap[index] = node.Get();
1188 nodeIndexMap[node.Get()] = index;
1189 }
1190 public override void Visit(ExplicitlyConvertibleConstraintNode& explicitlyConvertibleConstraintNode)
1191 {
1192 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ExplicitlyConvertibleConstraintNode)));
1193 node.Reset(treeViewNode.Release());
1194 node->SetData(&explicitlyConvertibleConstraintNode);
1195 Span span = explicitlyConvertibleConstraintNode.GetSpan();
1196 lexer.ConvertExternal(span);
1197 int index = span.start;
1198 indexNodeMap[index] = node.Get();
1199 nodeIndexMap[node.Get()] = index;
1200 }
1201 public override void Visit(CommonConstraintNode& commonConstraintNode)
1202 {
1203 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CommonConstraintNode)));
1204 node.Reset(treeViewNode.Release());
1205 node->SetData(&commonConstraintNode);
1206 Span span = commonConstraintNode.GetSpan();
1207 lexer.ConvertExternal(span);
1208 int index = span.start;
1209 indexNodeMap[index] = node.Get();
1210 nodeIndexMap[node.Get()] = index;
1211 }
1212 public override void Visit(NonreferenceTypeConstraintNode& nonreferenceTypeConstraintNode)
1213 {
1214 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(NonreferenceTypeConstraintNode)));
1215 node.Reset(treeViewNode.Release());
1216 node->SetData(&nonreferenceTypeConstraintNode);
1217 Span span = nonreferenceTypeConstraintNode.GetSpan();
1218 lexer.ConvertExternal(span);
1219 int index = span.start;
1220 indexNodeMap[index] = node.Get();
1221 nodeIndexMap[node.Get()] = index;
1222 }
1223 public override void Visit(LabelNode& labelNode)
1224 {
1225 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(LabelNode)));
1226 node.Reset(treeViewNode.Release());
1227 node->SetData(&labelNode);
1228 Span span = labelNode.GetSpan();
1229 lexer.ConvertExternal(span);
1230 int index = span.start;
1231 indexNodeMap[index] = node.Get();
1232 nodeIndexMap[node.Get()] = index;
1233 }
1234 public override void Visit(LabeledStatementNode& labeledStatementNode)
1235 {
1236 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(LabeledStatementNode)));
1237 labeledStatementNode.Label()->Accept(*this);
1238 treeViewNode->AddChild(node.Release());
1239 labeledStatementNode.Stmt()->Accept(*this);
1240 treeViewNode->AddChild(node.Release());
1241 node.Reset(treeViewNode.Release());
1242 node->SetData(&labeledStatementNode);
1243 Span span = labeledStatementNode.GetSpan();
1244 lexer.ConvertExternal(span);
1245 int index = span.start;
1246 indexNodeMap[index] = node.Get();
1247 nodeIndexMap[node.Get()] = index;
1248 }
1249 public override void Visit(CompoundStatementNode& compoundStatementNode)
1250 {
1251 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CompoundStatementNode)));
1252 int ns = compoundStatementNode.Statements().Count();
1253 for (int i = 0; i < ns; ++i;)
1254 {
1255 compoundStatementNode.Statements()[i]->Accept(*this);
1256 treeViewNode->AddChild(node.Release());
1257 }
1258 node.Reset(treeViewNode.Release());
1259 node->SetData(&compoundStatementNode);
1260 Span span = compoundStatementNode.GetSpan();
1261 lexer.ConvertExternal(span);
1262 int index = span.start;
1263 indexNodeMap[index] = node.Get();
1264 nodeIndexMap[node.Get()] = index;
1265 }
1266 public override void Visit(ReturnStatementNode& returnStatementNode)
1267 {
1268 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ReturnStatementNode)));
1269 if (returnStatementNode.Expression() != null)
1270 {
1271 returnStatementNode.Expression()->Accept(*this);
1272 treeViewNode->AddChild(node.Release());
1273 }
1274 node.Reset(treeViewNode.Release());
1275 node->SetData(&returnStatementNode);
1276 Span span = returnStatementNode.GetSpan();
1277 lexer.ConvertExternal(span);
1278 int index = span.start;
1279 indexNodeMap[index] = node.Get();
1280 nodeIndexMap[node.Get()] = index;
1281 }
1282 public override void Visit(IfStatementNode& ifStatementNode)
1283 {
1284 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(IfStatementNode)));
1285 ifStatementNode.Condition()->Accept(*this);
1286 treeViewNode->AddChild(node.Release());
1287 ifStatementNode.ThenS()->Accept(*this);
1288 treeViewNode->AddChild(node.Release());
1289 if (ifStatementNode.ElseS() != null)
1290 {
1291 ifStatementNode.ElseS()->Accept(*this);
1292 treeViewNode->AddChild(node.Release());
1293 }
1294 node.Reset(treeViewNode.Release());
1295 node->SetData(&ifStatementNode);
1296 Span span = ifStatementNode.GetSpan();
1297 lexer.ConvertExternal(span);
1298 int index = span.start;
1299 indexNodeMap[index] = node.Get();
1300 nodeIndexMap[node.Get()] = index;
1301 }
1302 public override void Visit(WhileStatementNode& whileStatementNode)
1303 {
1304 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(WhileStatementNode)));
1305 whileStatementNode.Condition()->Accept(*this);
1306 treeViewNode->AddChild(node.Release());
1307 whileStatementNode.Statement()->Accept(*this);
1308 treeViewNode->AddChild(node.Release());
1309 node.Reset(treeViewNode.Release());
1310 node->SetData(&whileStatementNode);
1311 Span span = whileStatementNode.GetSpan();
1312 lexer.ConvertExternal(span);
1313 int index = span.start;
1314 indexNodeMap[index] = node.Get();
1315 nodeIndexMap[node.Get()] = index;
1316 }
1317 public override void Visit(DoStatementNode& doStatementNode)
1318 {
1319 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DoStatementNode)));
1320 doStatementNode.Statement()->Accept(*this);
1321 treeViewNode->AddChild(node.Release());
1322 doStatementNode.Condition()->Accept(*this);
1323 treeViewNode->AddChild(node.Release());
1324 node.Reset(treeViewNode.Release());
1325 node->SetData(&doStatementNode);
1326 Span span = doStatementNode.GetSpan();
1327 lexer.ConvertExternal(span);
1328 int index = span.start;
1329 indexNodeMap[index] = node.Get();
1330 nodeIndexMap[node.Get()] = index;
1331 }
1332 public override void Visit(ForStatementNode& forStatementNode)
1333 {
1334 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ForStatementNode)));
1335 forStatementNode.InitS()->Accept(*this);
1336 treeViewNode->AddChild(node.Release());
1337 if (forStatementNode.Condition() != null)
1338 {
1339 forStatementNode.Condition()->Accept(*this);
1340 treeViewNode->AddChild(node.Release());
1341 }
1342 forStatementNode.LoopS()->Accept(*this);
1343 treeViewNode->AddChild(node.Release());
1344 forStatementNode.ActionS()->Accept(*this);
1345 treeViewNode->AddChild(node.Release());
1346 node.Reset(treeViewNode.Release());
1347 node->SetData(&forStatementNode);
1348 Span span = forStatementNode.GetSpan();
1349 lexer.ConvertExternal(span);
1350 int index = span.start;
1351 indexNodeMap[index] = node.Get();
1352 nodeIndexMap[node.Get()] = index;
1353 }
1354 public override void Visit(BreakStatementNode& breakStatementNode)
1355 {
1356 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(BreakStatementNode)));
1357 node.Reset(treeViewNode.Release());
1358 node->SetData(&breakStatementNode);
1359 Span span = breakStatementNode.GetSpan();
1360 lexer.ConvertExternal(span);
1361 int index = span.start;
1362 indexNodeMap[index] = node.Get();
1363 nodeIndexMap[node.Get()] = index;
1364 }
1365 public override void Visit(ContinueStatementNode& continueStatementNode)
1366 {
1367 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ContinueStatementNode)));
1368 node.Reset(treeViewNode.Release());
1369 node->SetData(&continueStatementNode);
1370 Span span = continueStatementNode.GetSpan();
1371 lexer.ConvertExternal(span);
1372 int index = span.start;
1373 indexNodeMap[index] = node.Get();
1374 nodeIndexMap[node.Get()] = index;
1375 }
1376 public override void Visit(GotoStatementNode& gotoStatementNode)
1377 {
1378 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(GotoStatementNode)));
1379 node.Reset(treeViewNode.Release());
1380 node->SetData(&gotoStatementNode);
1381 Span span = gotoStatementNode.GetSpan();
1382 lexer.ConvertExternal(span);
1383 int index = span.start;
1384 indexNodeMap[index] = node.Get();
1385 nodeIndexMap[node.Get()] = index;
1386 }
1387 public override void Visit(ConstructionStatementNode& constructionStatementNode)
1388 {
1389 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConstructionStatementNode)));
1390 constructionStatementNode.TypeExpr()->Accept(*this);
1391 treeViewNode->AddChild(node.Release());
1392 constructionStatementNode.Id()->Accept(*this);
1393 treeViewNode->AddChild(node.Release());
1394 int na = constructionStatementNode.Arguments().Count();
1395 for (int i = 0; i < na; ++i;)
1396 {
1397 constructionStatementNode.Arguments()[i]->Accept(*this);
1398 treeViewNode->AddChild(node.Release());
1399 }
1400 node.Reset(treeViewNode.Release());
1401 node->SetData(&constructionStatementNode);
1402 Span span = constructionStatementNode.GetSpan();
1403 lexer.ConvertExternal(span);
1404 int index = span.start;
1405 indexNodeMap[index] = node.Get();
1406 nodeIndexMap[node.Get()] = index;
1407 }
1408 public override void Visit(DeleteStatementNode& deleteStatementNode)
1409 {
1410 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DeleteStatementNode)));
1411 deleteStatementNode.Expression()->Accept(*this);
1412 treeViewNode->AddChild(node.Release());
1413 node.Reset(treeViewNode.Release());
1414 node->SetData(&deleteStatementNode);
1415 Span span = deleteStatementNode.GetSpan();
1416 lexer.ConvertExternal(span);
1417 int index = span.start;
1418 indexNodeMap[index] = node.Get();
1419 nodeIndexMap[node.Get()] = index;
1420 }
1421 public override void Visit(DestroyStatementNode& destroyStatementNode)
1422 {
1423 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DestroyStatementNode)));
1424 destroyStatementNode.Expression()->Accept(*this);
1425 treeViewNode->AddChild(node.Release());
1426 node.Reset(treeViewNode.Release());
1427 node->SetData(&destroyStatementNode);
1428 Span span = destroyStatementNode.GetSpan();
1429 lexer.ConvertExternal(span);
1430 int index = span.start;
1431 indexNodeMap[index] = node.Get();
1432 nodeIndexMap[node.Get()] = index;
1433 }
1434 public override void Visit(AssignmentStatementNode& assignmentStatementNode)
1435 {
1436 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AssignmentStatementNode)));
1437 assignmentStatementNode.TargetExpr()->Accept(*this);
1438 treeViewNode->AddChild(node.Release());
1439 assignmentStatementNode.SourceExpr()->Accept(*this);
1440 treeViewNode->AddChild(node.Release());
1441 node.Reset(treeViewNode.Release());
1442 node->SetData(&assignmentStatementNode);
1443 Span span = assignmentStatementNode.GetSpan();
1444 lexer.ConvertExternal(span);
1445 int index = span.start;
1446 indexNodeMap[index] = node.Get();
1447 nodeIndexMap[node.Get()] = index;
1448 }
1449 public override void Visit(ExpressionStatementNode& expressionStatementNode)
1450 {
1451 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ExpressionStatementNode)));
1452 expressionStatementNode.Expression()->Accept(*this);
1453 treeViewNode->AddChild(node.Release());
1454 node.Reset(treeViewNode.Release());
1455 node->SetData(&expressionStatementNode);
1456 Span span = expressionStatementNode.GetSpan();
1457 lexer.ConvertExternal(span);
1458 int index = span.start;
1459 indexNodeMap[index] = node.Get();
1460 nodeIndexMap[node.Get()] = index;
1461 }
1462 public override void Visit(EmptyStatementNode& emptyStatementNode)
1463 {
1464 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(EmptyStatementNode)));
1465 node.Reset(treeViewNode.Release());
1466 node->SetData(&emptyStatementNode);
1467 Span span = emptyStatementNode.GetSpan();
1468 lexer.ConvertExternal(span);
1469 int index = span.start;
1470 indexNodeMap[index] = node.Get();
1471 nodeIndexMap[node.Get()] = index;
1472 }
1473 public override void Visit(RangeForStatementNode& rangeForStatementNode)
1474 {
1475 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(RangeForStatementNode)));
1476 rangeForStatementNode.TypeExpr()->Accept(*this);
1477 treeViewNode->AddChild(node.Release());
1478 rangeForStatementNode.Id()->Accept(*this);
1479 treeViewNode->AddChild(node.Release());
1480 rangeForStatementNode.Container()->Accept(*this);
1481 treeViewNode->AddChild(node.Release());
1482 rangeForStatementNode.Action()->Accept(*this);
1483 treeViewNode->AddChild(node.Release());
1484 node.Reset(treeViewNode.Release());
1485 node->SetData(&rangeForStatementNode);
1486 Span span = rangeForStatementNode.GetSpan();
1487 lexer.ConvertExternal(span);
1488 int index = span.start;
1489 indexNodeMap[index] = node.Get();
1490 nodeIndexMap[node.Get()] = index;
1491 }
1492 public override void Visit(SwitchStatementNode& switchStatementNode)
1493 {
1494 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(SwitchStatementNode)));
1495 switchStatementNode.Condition()->Accept(*this);
1496 treeViewNode->AddChild(node.Release());
1497 int nc = switchStatementNode.Cases().Count();
1498 for (int i = 0; i < nc; ++i;)
1499 {
1500 switchStatementNode.Cases()[i]->Accept(*this);
1501 treeViewNode->AddChild(node.Release());
1502 }
1503 if (switchStatementNode.Default() != null)
1504 {
1505 switchStatementNode.Default()->Accept(*this);
1506 treeViewNode->AddChild(node.Release());
1507 }
1508 node.Reset(treeViewNode.Release());
1509 node->SetData(&switchStatementNode);
1510 Span span = switchStatementNode.GetSpan();
1511 lexer.ConvertExternal(span);
1512 int index = span.start;
1513 indexNodeMap[index] = node.Get();
1514 nodeIndexMap[node.Get()] = index;
1515 }
1516 public override void Visit(CaseStatementNode& caseStatementNode)
1517 {
1518 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CaseStatementNode)));
1519 int nc = caseStatementNode.CaseExprs().Count();
1520 for (int i = 0; i < nc; ++i;)
1521 {
1522 caseStatementNode.CaseExprs()[i]->Accept(*this);
1523 treeViewNode->AddChild(node.Release());
1524 }
1525 int ns = caseStatementNode.Statements().Count();
1526 for (int i = 0; i < ns; ++i;)
1527 {
1528 caseStatementNode.Statements()[i]->Accept(*this);
1529 treeViewNode->AddChild(node.Release());
1530 }
1531 node.Reset(treeViewNode.Release());
1532 node->SetData(&caseStatementNode);
1533 Span span = caseStatementNode.GetSpan();
1534 lexer.ConvertExternal(span);
1535 int index = span.start;
1536 indexNodeMap[index] = node.Get();
1537 nodeIndexMap[node.Get()] = index;
1538 }
1539 public override void Visit(DefaultStatementNode& defaultStatementNode)
1540 {
1541 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DefaultStatementNode)));
1542 int ns = defaultStatementNode.Statements().Count();
1543 for (int i = 0; i < ns; ++i;)
1544 {
1545 defaultStatementNode.Statements()[i]->Accept(*this);
1546 treeViewNode->AddChild(node.Release());
1547 }
1548 node.Reset(treeViewNode.Release());
1549 node->SetData(&defaultStatementNode);
1550 Span span = defaultStatementNode.GetSpan();
1551 lexer.ConvertExternal(span);
1552 int index = span.start;
1553 indexNodeMap[index] = node.Get();
1554 nodeIndexMap[node.Get()] = index;
1555 }
1556 public override void Visit(GotoCaseStatementNode& gotoCaseStatementNode)
1557 {
1558 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(GotoCaseStatementNode)));
1559 gotoCaseStatementNode.CaseExpr()->Accept(*this);
1560 treeViewNode->AddChild(node.Release());
1561 node.Reset(treeViewNode.Release());
1562 node->SetData(&gotoCaseStatementNode);
1563 Span span = gotoCaseStatementNode.GetSpan();
1564 lexer.ConvertExternal(span);
1565 int index = span.start;
1566 indexNodeMap[index] = node.Get();
1567 nodeIndexMap[node.Get()] = index;
1568 }
1569 public override void Visit(GotoDefaultStatementNode& gotoDefaultStatementNode)
1570 {
1571 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(GotoDefaultStatementNode)));
1572 node.Reset(treeViewNode.Release());
1573 node->SetData(&gotoDefaultStatementNode);
1574 Span span = gotoDefaultStatementNode.GetSpan();
1575 lexer.ConvertExternal(span);
1576 int index = span.start;
1577 indexNodeMap[index] = node.Get();
1578 nodeIndexMap[node.Get()] = index;
1579 }
1580 public override void Visit(ThrowStatementNode& throwStatementNode)
1581 {
1582 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ThrowStatementNode)));
1583 if (throwStatementNode.Expression() != null)
1584 {
1585 throwStatementNode.Expression()->Accept(*this);
1586 treeViewNode->AddChild(node.Release());
1587 }
1588 node.Reset(treeViewNode.Release());
1589 node->SetData(&throwStatementNode);
1590 Span span = throwStatementNode.GetSpan();
1591 lexer.ConvertExternal(span);
1592 int index = span.start;
1593 indexNodeMap[index] = node.Get();
1594 nodeIndexMap[node.Get()] = index;
1595 }
1596 public override void Visit(TryStatementNode& tryStatementNode)
1597 {
1598 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TryStatementNode)));
1599 tryStatementNode.TryBlock()->Accept(*this);
1600 treeViewNode->AddChild(node.Release());
1601 int n = tryStatementNode.Catches().Count();
1602 for (int i = 0; i < n; ++i;)
1603 {
1604 tryStatementNode.Catches()[i]->Accept(*this);
1605 treeViewNode->AddChild(node.Release());
1606 }
1607 node.Reset(treeViewNode.Release());
1608 node->SetData(&tryStatementNode);
1609 Span span = tryStatementNode.GetSpan();
1610 lexer.ConvertExternal(span);
1611 int index = span.start;
1612 indexNodeMap[index] = node.Get();
1613 nodeIndexMap[node.Get()] = index;
1614 }
1615 public override void Visit(CatchNode& catchNode)
1616 {
1617 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CatchNode)));
1618 catchNode.TypeExpr()->Accept(*this);
1619 treeViewNode->AddChild(node.Release());
1620 if (catchNode.Id() != null)
1621 {
1622 catchNode.Id()->Accept(*this);
1623 treeViewNode->AddChild(node.Release());
1624 }
1625 catchNode.CatchBlock()->Accept(*this);
1626 treeViewNode->AddChild(node.Release());
1627 node.Reset(treeViewNode.Release());
1628 node->SetData(&catchNode);
1629 Span span = catchNode.GetSpan();
1630 lexer.ConvertExternal(span);
1631 int index = span.start;
1632 indexNodeMap[index] = node.Get();
1633 nodeIndexMap[node.Get()] = index;
1634 }
1635 public override void Visit(AssertStatementNode& assertStatementNode)
1636 {
1637 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AssertStatementNode)));
1638 assertStatementNode.AssertExpr()->Accept(*this);
1639 treeViewNode->AddChild(node.Release());
1640 node.Reset(treeViewNode.Release());
1641 node->SetData(&assertStatementNode);
1642 Span span = assertStatementNode.GetSpan();
1643 lexer.ConvertExternal(span);
1644 int index = span.start;
1645 indexNodeMap[index] = node.Get();
1646 nodeIndexMap[node.Get()] = index;
1647 }
1648 public override void Visit(ConditionalCompilationPartNode& conditionalCompilationPartNode)
1649 {
1650 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConditionalCompilationPartNode)));
1651 if (conditionalCompilationPartNode.Expr() != null)
1652 {
1653 conditionalCompilationPartNode.Expr()->Accept(*this);
1654 treeViewNode->AddChild(node.Release());
1655 }
1656 int n = conditionalCompilationPartNode.Statements().Count();
1657 for (int i = 0; i < n; ++i;)
1658 {
1659 conditionalCompilationPartNode.Statements()[i]->Accept(*this);
1660 treeViewNode->AddChild(node.Release());
1661 }
1662 node.Reset(treeViewNode.Release());
1663 node->SetData(&conditionalCompilationPartNode);
1664 Span span = conditionalCompilationPartNode.GetSpan();
1665 lexer.ConvertExternal(span);
1666 int index = span.start;
1667 indexNodeMap[index] = node.Get();
1668 nodeIndexMap[node.Get()] = index;
1669 }
1670 public override void Visit(ConditionalCompilationDisjunctionNode& conditionalCompilationDisjunctionNode)
1671 {
1672 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConditionalCompilationDisjunctionNode)));
1673 conditionalCompilationDisjunctionNode.Left()->Accept(*this);
1674 treeViewNode->AddChild(node.Release());
1675 conditionalCompilationDisjunctionNode.Right()->Accept(*this);
1676 treeViewNode->AddChild(node.Release());
1677 node.Reset(treeViewNode.Release());
1678 node->SetData(&conditionalCompilationDisjunctionNode);
1679 Span span = conditionalCompilationDisjunctionNode.GetSpan();
1680 lexer.ConvertExternal(span);
1681 int index = span.start;
1682 indexNodeMap[index] = node.Get();
1683 nodeIndexMap[node.Get()] = index;
1684 }
1685 public override void Visit(ConditionalCompilationConjunctionNode& conditionalCompilationConjunctionNode)
1686 {
1687 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConditionalCompilationConjunctionNode)));
1688 conditionalCompilationConjunctionNode.Left()->Accept(*this);
1689 treeViewNode->AddChild(node.Release());
1690 conditionalCompilationConjunctionNode.Right()->Accept(*this);
1691 treeViewNode->AddChild(node.Release());
1692 node.Reset(treeViewNode.Release());
1693 node->SetData(&conditionalCompilationConjunctionNode);
1694 Span span = conditionalCompilationConjunctionNode.GetSpan();
1695 lexer.ConvertExternal(span);
1696 int index = span.start;
1697 indexNodeMap[index] = node.Get();
1698 nodeIndexMap[node.Get()] = index;
1699 }
1700 public override void Visit(ConditionalCompilationNotNode& conditionalCompilationNotNode)
1701 {
1702 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConditionalCompilationNotNode)));
1703 conditionalCompilationNotNode.Expr()->Accept(*this);
1704 treeViewNode->AddChild(node.Release());
1705 node.Reset(treeViewNode.Release());
1706 node->SetData(&conditionalCompilationNotNode);
1707 Span span = conditionalCompilationNotNode.GetSpan();
1708 lexer.ConvertExternal(span);
1709 int index = span.start;
1710 indexNodeMap[index] = node.Get();
1711 nodeIndexMap[node.Get()] = index;
1712 }
1713 public override void Visit(ConditionalCompilationPrimaryNode& conditionalCompilationPrimaryNode)
1714 {
1715 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConditionalCompilationPrimaryNode)));
1716 node.Reset(treeViewNode.Release());
1717 node->SetData(&conditionalCompilationPrimaryNode);
1718 Span span = conditionalCompilationPrimaryNode.GetSpan();
1719 lexer.ConvertExternal(span);
1720 int index = span.start;
1721 indexNodeMap[index] = node.Get();
1722 nodeIndexMap[node.Get()] = index;
1723 }
1724 public override void Visit(ParenthesizedConditionalCompilationExpressionNode& parenthesizeCondCompExprNode)
1725 {
1726 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ParenthesizedConditionalCompilationExpressionNode)));
1727 parenthesizeCondCompExprNode.Expr()->Accept(*this);
1728 treeViewNode->AddChild(node.Release());
1729 node.Reset(treeViewNode.Release());
1730 node->SetData(&parenthesizeCondCompExprNode);
1731 Span span = parenthesizeCondCompExprNode.GetSpan();
1732 lexer.ConvertExternal(span);
1733 int index = span.start;
1734 indexNodeMap[index] = node.Get();
1735 nodeIndexMap[node.Get()] = index;
1736 }
1737 public override void Visit(ConditionalCompilationStatementNode& conditionalCompilationStatementNode)
1738 {
1739 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConditionalCompilationStatementNode)));
1740 conditionalCompilationStatementNode.IfPart()->Accept(*this);
1741 treeViewNode->AddChild(node.Release());
1742 int n = conditionalCompilationStatementNode.ElifParts().Count();
1743 for (int i = 0; i < n; ++i;)
1744 {
1745 conditionalCompilationStatementNode.ElifParts()[i]->Accept(*this);
1746 treeViewNode->AddChild(node.Release());
1747 }
1748 if (conditionalCompilationStatementNode.ElsePart() != null)
1749 {
1750 conditionalCompilationStatementNode.ElsePart()->Accept(*this);
1751 treeViewNode->AddChild(node.Release());
1752 }
1753 node.Reset(treeViewNode.Release());
1754 node->SetData(&conditionalCompilationStatementNode);
1755 Span span = conditionalCompilationStatementNode.GetSpan();
1756 lexer.ConvertExternal(span);
1757 int index = span.start;
1758 indexNodeMap[index] = node.Get();
1759 nodeIndexMap[node.Get()] = index;
1760 }
1761 public override void Visit(TypedefNode& typedefNode)
1762 {
1763 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TypedefNode)));
1764 typedefNode.TypeExpr()->Accept(*this);
1765 treeViewNode->AddChild(node.Release());
1766 typedefNode.Id()->Accept(*this);
1767 treeViewNode->AddChild(node.Release());
1768 node.Reset(treeViewNode.Release());
1769 node->SetData(&typedefNode);
1770 Span span = typedefNode.GetSpan();
1771 lexer.ConvertExternal(span);
1772 int index = span.start;
1773 indexNodeMap[index] = node.Get();
1774 nodeIndexMap[node.Get()] = index;
1775 }
1776 public override void Visit(ConstantNode& constantNode)
1777 {
1778 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConstantNode)));
1779 constantNode.TypeExpr()->Accept(*this);
1780 treeViewNode->AddChild(node.Release());
1781 constantNode.Id()->Accept(*this);
1782 treeViewNode->AddChild(node.Release());
1783 constantNode.Value()->Accept(*this);
1784 treeViewNode->AddChild(node.Release());
1785 node.Reset(treeViewNode.Release());
1786 node->SetData(&constantNode);
1787 Span span = constantNode.GetSpan();
1788 lexer.ConvertExternal(span);
1789 int index = span.start;
1790 indexNodeMap[index] = node.Get();
1791 nodeIndexMap[node.Get()] = index;
1792 }
1793 public override void Visit(EnumTypeNode& enumTypeNode)
1794 {
1795 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(EnumTypeNode)));
1796 enumTypeNode.Id()->Accept(*this);
1797 treeViewNode->AddChild(node.Release());
1798 if (enumTypeNode.GetUnderlyingType() != null)
1799 {
1800 enumTypeNode.GetUnderlyingType()->Accept(*this);
1801 treeViewNode->AddChild(node.Release());
1802 }
1803 int n = enumTypeNode.Constants().Count();
1804 for (int i = 0; i < n; ++i;)
1805 {
1806 enumTypeNode.Constants()[i]->Accept(*this);
1807 treeViewNode->AddChild(node.Release());
1808 }
1809 node.Reset(treeViewNode.Release());
1810 node->SetData(&enumTypeNode);
1811 Span span = enumTypeNode.GetSpan();
1812 lexer.ConvertExternal(span);
1813 int index = span.start;
1814 indexNodeMap[index] = node.Get();
1815 nodeIndexMap[node.Get()] = index;
1816 }
1817 public override void Visit(EnumConstantNode& enumConstantNode)
1818 {
1819 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(EnumConstantNode)));
1820 if (enumConstantNode.HasValue())
1821 {
1822 if (enumConstantNode.GetValue() != null)
1823 {
1824 enumConstantNode.GetValue()->Accept(*this);
1825 treeViewNode->AddChild(node.Release());
1826 }
1827 }
1828 enumConstantNode.Id()->Accept(*this);
1829 treeViewNode->AddChild(node.Release());
1830 node.Reset(treeViewNode.Release());
1831 node->SetData(&enumConstantNode);
1832 Span span = enumConstantNode.GetSpan();
1833 lexer.ConvertExternal(span);
1834 int index = span.start;
1835 indexNodeMap[index] = node.Get();
1836 nodeIndexMap[node.Get()] = index;
1837 }
1838 public override void Visit(ParameterNode& parameterNode)
1839 {
1840 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ParameterNode)));
1841 parameterNode.TypeExpr()->Accept(*this);
1842 treeViewNode->AddChild(node.Release());
1843 if (parameterNode.Id() != null)
1844 {
1845 parameterNode.Id()->Accept(*this);
1846 treeViewNode->AddChild(node.Release());
1847 }
1848 node.Reset(treeViewNode.Release());
1849 node->SetData(¶meterNode);
1850 Span span = parameterNode.GetSpan();
1851 lexer.ConvertExternal(span);
1852 int index = span.start;
1853 indexNodeMap[index] = node.Get();
1854 nodeIndexMap[node.Get()] = index;
1855 }
1856 public override void Visit(TemplateParameterNode& templateParameterNode)
1857 {
1858 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TemplateParameterNode)));
1859 templateParameterNode.Id()->Accept(*this);
1860 treeViewNode->AddChild(node.Release());
1861 if (templateParameterNode.DefaultTemplateArgument() != null)
1862 {
1863 templateParameterNode.DefaultTemplateArgument()->Accept(*this);
1864 treeViewNode->AddChild(node.Release());
1865 }
1866 node.Reset(treeViewNode.Release());
1867 node->SetData(&templateParameterNode);
1868 Span span = templateParameterNode.GetSpan();
1869 lexer.ConvertExternal(span);
1870 int index = span.start;
1871 indexNodeMap[index] = node.Get();
1872 nodeIndexMap[node.Get()] = index;
1873 }
1874 public override void Visit(ConstNode& constNode)
1875 {
1876 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConstNode)));
1877 constNode.Subject()->Accept(*this);
1878 treeViewNode->AddChild(node.Release());
1879 node.Reset(treeViewNode.Release());
1880 node->SetData(&constNode);
1881 Span span = constNode.GetSpan();
1882 lexer.ConvertExternal(span);
1883 int index = span.start;
1884 indexNodeMap[index] = node.Get();
1885 nodeIndexMap[node.Get()] = index;
1886 }
1887 public override void Visit(LValueRefNode& lvalueRefNode)
1888 {
1889 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(LValueRefNode)));
1890 lvalueRefNode.Subject()->Accept(*this);
1891 treeViewNode->AddChild(node.Release());
1892 node.Reset(treeViewNode.Release());
1893 node->SetData(&lvalueRefNode);
1894 Span span = lvalueRefNode.GetSpan();
1895 lexer.ConvertExternal(span);
1896 int index = span.start;
1897 indexNodeMap[index] = node.Get();
1898 nodeIndexMap[node.Get()] = index;
1899 }
1900 public override void Visit(RValueRefNode& rvalueRefNode)
1901 {
1902 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(RValueRefNode)));
1903 rvalueRefNode.Subject()->Accept(*this);
1904 treeViewNode->AddChild(node.Release());
1905 node.Reset(treeViewNode.Release());
1906 node->SetData(&rvalueRefNode);
1907 Span span = rvalueRefNode.GetSpan();
1908 lexer.ConvertExternal(span);
1909 int index = span.start;
1910 indexNodeMap[index] = node.Get();
1911 nodeIndexMap[node.Get()] = index;
1912 }
1913 public override void Visit(PointerNode& pointerNode)
1914 {
1915 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(PointerNode)));
1916 pointerNode.Subject()->Accept(*this);
1917 treeViewNode->AddChild(node.Release());
1918 node.Reset(treeViewNode.Release());
1919 node->SetData(&pointerNode);
1920 Span span = pointerNode.GetSpan();
1921 lexer.ConvertExternal(span);
1922 int index = span.start;
1923 indexNodeMap[index] = node.Get();
1924 nodeIndexMap[node.Get()] = index;
1925 }
1926 public override void Visit(ArrayNode& arrayNode)
1927 {
1928 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ArrayNode)));
1929 arrayNode.Subject()->Accept(*this);
1930 treeViewNode->AddChild(node.Release());
1931 if (arrayNode.Size() != null)
1932 {
1933 arrayNode.Size()->Accept(*this);
1934 treeViewNode->AddChild(node.Release());
1935 }
1936 node.Reset(treeViewNode.Release());
1937 node->SetData(&arrayNode);
1938 Span span = arrayNode.GetSpan();
1939 lexer.ConvertExternal(span);
1940 int index = span.start;
1941 indexNodeMap[index] = node.Get();
1942 nodeIndexMap[node.Get()] = index;
1943 }
1944 public override void Visit(DotNode& dotNode)
1945 {
1946 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DotNode)));
1947 dotNode.Subject()->Accept(*this);
1948 treeViewNode->AddChild(node.Release());
1949 dotNode.MemberId()->Accept(*this);
1950 treeViewNode->AddChild(node.Release());
1951 node.Reset(treeViewNode.Release());
1952 node->SetData(&dotNode);
1953 Span span = dotNode.GetSpan();
1954 lexer.ConvertExternal(span);
1955 int index = span.start;
1956 indexNodeMap[index] = node.Get();
1957 nodeIndexMap[node.Get()] = index;
1958 }
1959 public override void Visit(ArrowNode& arrowNode)
1960 {
1961 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ArrowNode)));
1962 arrowNode.Subject()->Accept(*this);
1963 treeViewNode->AddChild(node.Release());
1964 arrowNode.MemberId()->Accept(*this);
1965 treeViewNode->AddChild(node.Release());
1966 node.Reset(treeViewNode.Release());
1967 node->SetData(&arrowNode);
1968 Span span = arrowNode.GetSpan();
1969 lexer.ConvertExternal(span);
1970 int index = span.start;
1971 indexNodeMap[index] = node.Get();
1972 nodeIndexMap[node.Get()] = index;
1973 }
1974 public override void Visit(EquivalenceNode& equivalenceNode)
1975 {
1976 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(EquivalenceNode)));
1977 equivalenceNode.Left()->Accept(*this);
1978 treeViewNode->AddChild(node.Release());
1979 equivalenceNode.Right()->Accept(*this);
1980 treeViewNode->AddChild(node.Release());
1981 node.Reset(treeViewNode.Release());
1982 node->SetData(&equivalenceNode);
1983 Span span = equivalenceNode.GetSpan();
1984 lexer.ConvertExternal(span);
1985 int index = span.start;
1986 indexNodeMap[index] = node.Get();
1987 nodeIndexMap[node.Get()] = index;
1988 }
1989 public override void Visit(ImplicationNode& implicationNode)
1990 {
1991 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ImplicationNode)));
1992 implicationNode.Left()->Accept(*this);
1993 treeViewNode->AddChild(node.Release());
1994 implicationNode.Right()->Accept(*this);
1995 treeViewNode->AddChild(node.Release());
1996 node.Reset(treeViewNode.Release());
1997 node->SetData(&implicationNode);
1998 Span span = implicationNode.GetSpan();
1999 lexer.ConvertExternal(span);
2000 int index = span.start;
2001 indexNodeMap[index] = node.Get();
2002 nodeIndexMap[node.Get()] = index;
2003 }
2004 public override void Visit(DisjunctionNode& disjunctionNode)
2005 {
2006 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DisjunctionNode)));
2007 disjunctionNode.Left()->Accept(*this);
2008 treeViewNode->AddChild(node.Release());
2009 disjunctionNode.Right()->Accept(*this);
2010 treeViewNode->AddChild(node.Release());
2011 node.Reset(treeViewNode.Release());
2012 node->SetData(&disjunctionNode);
2013 Span span = disjunctionNode.GetSpan();
2014 lexer.ConvertExternal(span);
2015 int index = span.start;
2016 indexNodeMap[index] = node.Get();
2017 nodeIndexMap[node.Get()] = index;
2018 }
2019 public override void Visit(ConjunctionNode& conjunctionNode)
2020 {
2021 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConjunctionNode)));
2022 conjunctionNode.Left()->Accept(*this);
2023 treeViewNode->AddChild(node.Release());
2024 conjunctionNode.Right()->Accept(*this);
2025 treeViewNode->AddChild(node.Release());
2026 node.Reset(treeViewNode.Release());
2027 node->SetData(&conjunctionNode);
2028 Span span = conjunctionNode.GetSpan();
2029 lexer.ConvertExternal(span);
2030 int index = span.start;
2031 indexNodeMap[index] = node.Get();
2032 nodeIndexMap[node.Get()] = index;
2033 }
2034 public override void Visit(BitOrNode& bitOrNode)
2035 {
2036 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(BitOrNode)));
2037 bitOrNode.Left()->Accept(*this);
2038 treeViewNode->AddChild(node.Release());
2039 bitOrNode.Right()->Accept(*this);
2040 treeViewNode->AddChild(node.Release());
2041 node.Reset(treeViewNode.Release());
2042 node->SetData(&bitOrNode);
2043 Span span = bitOrNode.GetSpan();
2044 lexer.ConvertExternal(span);
2045 int index = span.start;
2046 indexNodeMap[index] = node.Get();
2047 nodeIndexMap[node.Get()] = index;
2048 }
2049 public override void Visit(BitXorNode& bitXorNode)
2050 {
2051 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(BitXorNode)));
2052 bitXorNode.Left()->Accept(*this);
2053 treeViewNode->AddChild(node.Release());
2054 bitXorNode.Right()->Accept(*this);
2055 treeViewNode->AddChild(node.Release());
2056 node.Reset(treeViewNode.Release());
2057 node->SetData(&bitXorNode);
2058 Span span = bitXorNode.GetSpan();
2059 lexer.ConvertExternal(span);
2060 int index = span.start;
2061 indexNodeMap[index] = node.Get();
2062 nodeIndexMap[node.Get()] = index;
2063 }
2064 public override void Visit(BitAndNode& bitAndNode)
2065 {
2066 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(BitAndNode)));
2067 bitAndNode.Left()->Accept(*this);
2068 treeViewNode->AddChild(node.Release());
2069 bitAndNode.Right()->Accept(*this);
2070 treeViewNode->AddChild(node.Release());
2071 node.Reset(treeViewNode.Release());
2072 node->SetData(&bitAndNode);
2073 Span span = bitAndNode.GetSpan();
2074 lexer.ConvertExternal(span);
2075 int index = span.start;
2076 indexNodeMap[index] = node.Get();
2077 nodeIndexMap[node.Get()] = index;
2078 }
2079 public override void Visit(EqualNode& equalNode)
2080 {
2081 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(EqualNode)));
2082 equalNode.Left()->Accept(*this);
2083 treeViewNode->AddChild(node.Release());
2084 equalNode.Right()->Accept(*this);
2085 treeViewNode->AddChild(node.Release());
2086 node.Reset(treeViewNode.Release());
2087 node->SetData(&equalNode);
2088 Span span = equalNode.GetSpan();
2089 lexer.ConvertExternal(span);
2090 int index = span.start;
2091 indexNodeMap[index] = node.Get();
2092 nodeIndexMap[node.Get()] = index;
2093 }
2094 public override void Visit(NotEqualNode& notEqualNode)
2095 {
2096 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(NotEqualNode)));
2097 notEqualNode.Left()->Accept(*this);
2098 treeViewNode->AddChild(node.Release());
2099 notEqualNode.Right()->Accept(*this);
2100 treeViewNode->AddChild(node.Release());
2101 node.Reset(treeViewNode.Release());
2102 node->SetData(¬EqualNode);
2103 Span span = notEqualNode.GetSpan();
2104 lexer.ConvertExternal(span);
2105 int index = span.start;
2106 indexNodeMap[index] = node.Get();
2107 nodeIndexMap[node.Get()] = index;
2108 }
2109 public override void Visit(LessNode& lessNode)
2110 {
2111 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(LessNode)));
2112 lessNode.Left()->Accept(*this);
2113 treeViewNode->AddChild(node.Release());
2114 lessNode.Right()->Accept(*this);
2115 treeViewNode->AddChild(node.Release());
2116 node.Reset(treeViewNode.Release());
2117 node->SetData(&lessNode);
2118 Span span = lessNode.GetSpan();
2119 lexer.ConvertExternal(span);
2120 int index = span.start;
2121 indexNodeMap[index] = node.Get();
2122 nodeIndexMap[node.Get()] = index;
2123 }
2124 public override void Visit(GreaterNode& greaterNode)
2125 {
2126 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(GreaterNode)));
2127 greaterNode.Left()->Accept(*this);
2128 treeViewNode->AddChild(node.Release());
2129 greaterNode.Right()->Accept(*this);
2130 treeViewNode->AddChild(node.Release());
2131 node.Reset(treeViewNode.Release());
2132 node->SetData(&greaterNode);
2133 Span span = greaterNode.GetSpan();
2134 lexer.ConvertExternal(span);
2135 int index = span.start;
2136 indexNodeMap[index] = node.Get();
2137 nodeIndexMap[node.Get()] = index;
2138 }
2139 public override void Visit(LessOrEqualNode& lessOrEqualNode)
2140 {
2141 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(LessOrEqualNode)));
2142 lessOrEqualNode.Left()->Accept(*this);
2143 treeViewNode->AddChild(node.Release());
2144 lessOrEqualNode.Right()->Accept(*this);
2145 treeViewNode->AddChild(node.Release());
2146 node.Reset(treeViewNode.Release());
2147 node->SetData(&lessOrEqualNode);
2148 Span span = lessOrEqualNode.GetSpan();
2149 lexer.ConvertExternal(span);
2150 int index = span.start;
2151 indexNodeMap[index] = node.Get();
2152 nodeIndexMap[node.Get()] = index;
2153 }
2154 public override void Visit(GreaterOrEqualNode& greaterOrEqualNode)
2155 {
2156 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(GreaterOrEqualNode)));
2157 greaterOrEqualNode.Left()->Accept(*this);
2158 treeViewNode->AddChild(node.Release());
2159 greaterOrEqualNode.Right()->Accept(*this);
2160 treeViewNode->AddChild(node.Release());
2161 node.Reset(treeViewNode.Release());
2162 node->SetData(&greaterOrEqualNode);
2163 Span span = greaterOrEqualNode.GetSpan();
2164 lexer.ConvertExternal(span);
2165 int index = span.start;
2166 indexNodeMap[index] = node.Get();
2167 nodeIndexMap[node.Get()] = index;
2168 }
2169 public override void Visit(ShiftLeftNode& shiftLeftNode)
2170 {
2171 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ShiftLeftNode)));
2172 shiftLeftNode.Left()->Accept(*this);
2173 treeViewNode->AddChild(node.Release());
2174 shiftLeftNode.Right()->Accept(*this);
2175 treeViewNode->AddChild(node.Release());
2176 node.Reset(treeViewNode.Release());
2177 node->SetData(&shiftLeftNode);
2178 Span span = shiftLeftNode.GetSpan();
2179 lexer.ConvertExternal(span);
2180 int index = span.start;
2181 indexNodeMap[index] = node.Get();
2182 nodeIndexMap[node.Get()] = index;
2183 }
2184 public override void Visit(ShiftRightNode& shiftRightNode)
2185 {
2186 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ShiftRightNode)));
2187 shiftRightNode.Left()->Accept(*this);
2188 treeViewNode->AddChild(node.Release());
2189 shiftRightNode.Right()->Accept(*this);
2190 treeViewNode->AddChild(node.Release());
2191 node.Reset(treeViewNode.Release());
2192 node->SetData(&shiftRightNode);
2193 Span span = shiftRightNode.GetSpan();
2194 lexer.ConvertExternal(span);
2195 int index = span.start;
2196 indexNodeMap[index] = node.Get();
2197 nodeIndexMap[node.Get()] = index;
2198 }
2199 public override void Visit(AddNode& addNode)
2200 {
2201 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AddNode)));
2202 addNode.Left()->Accept(*this);
2203 treeViewNode->AddChild(node.Release());
2204 addNode.Right()->Accept(*this);
2205 treeViewNode->AddChild(node.Release());
2206 node.Reset(treeViewNode.Release());
2207 node->SetData(&addNode);
2208 Span span = addNode.GetSpan();
2209 lexer.ConvertExternal(span);
2210 int index = span.start;
2211 indexNodeMap[index] = node.Get();
2212 nodeIndexMap[node.Get()] = index;
2213 }
2214 public override void Visit(SubNode& subNode)
2215 {
2216 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(SubNode)));
2217 subNode.Left()->Accept(*this);
2218 treeViewNode->AddChild(node.Release());
2219 subNode.Right()->Accept(*this);
2220 treeViewNode->AddChild(node.Release());
2221 node.Reset(treeViewNode.Release());
2222 node->SetData(&subNode);
2223 Span span = subNode.GetSpan();
2224 lexer.ConvertExternal(span);
2225 int index = span.start;
2226 indexNodeMap[index] = node.Get();
2227 nodeIndexMap[node.Get()] = index;
2228 }
2229 public override void Visit(MulNode& mulNode)
2230 {
2231 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(MulNode)));
2232 mulNode.Left()->Accept(*this);
2233 treeViewNode->AddChild(node.Release());
2234 mulNode.Right()->Accept(*this);
2235 treeViewNode->AddChild(node.Release());
2236 node.Reset(treeViewNode.Release());
2237 node->SetData(&mulNode);
2238 Span span = mulNode.GetSpan();
2239 lexer.ConvertExternal(span);
2240 int index = span.start;
2241 indexNodeMap[index] = node.Get();
2242 nodeIndexMap[node.Get()] = index;
2243 }
2244 public override void Visit(DivNode& divNode)
2245 {
2246 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DivNode)));
2247 divNode.Left()->Accept(*this);
2248 treeViewNode->AddChild(node.Release());
2249 divNode.Right()->Accept(*this);
2250 treeViewNode->AddChild(node.Release());
2251 node.Reset(treeViewNode.Release());
2252 node->SetData(&divNode);
2253 Span span = divNode.GetSpan();
2254 lexer.ConvertExternal(span);
2255 int index = span.start;
2256 indexNodeMap[index] = node.Get();
2257 nodeIndexMap[node.Get()] = index;
2258 }
2259 public override void Visit(RemNode& remNode)
2260 {
2261 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(RemNode)));
2262 remNode.Left()->Accept(*this);
2263 treeViewNode->AddChild(node.Release());
2264 remNode.Right()->Accept(*this);
2265 treeViewNode->AddChild(node.Release());
2266 node.Reset(treeViewNode.Release());
2267 node->SetData(&remNode);
2268 Span span = remNode.GetSpan();
2269 lexer.ConvertExternal(span);
2270 int index = span.start;
2271 indexNodeMap[index] = node.Get();
2272 nodeIndexMap[node.Get()] = index;
2273 }
2274 public override void Visit(NotNode& notNode)
2275 {
2276 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(NotNode)));
2277 notNode.Subject()->Accept(*this);
2278 treeViewNode->AddChild(node.Release());
2279 node.Reset(treeViewNode.Release());
2280 node->SetData(¬Node);
2281 Span span = notNode.GetSpan();
2282 lexer.ConvertExternal(span);
2283 int index = span.start;
2284 indexNodeMap[index] = node.Get();
2285 nodeIndexMap[node.Get()] = index;
2286 }
2287 public override void Visit(UnaryPlusNode& unaryPlusNode)
2288 {
2289 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(UnaryPlusNode)));
2290 unaryPlusNode.Subject()->Accept(*this);
2291 treeViewNode->AddChild(node.Release());
2292 node.Reset(treeViewNode.Release());
2293 node->SetData(&unaryPlusNode);
2294 Span span = unaryPlusNode.GetSpan();
2295 lexer.ConvertExternal(span);
2296 int index = span.start;
2297 indexNodeMap[index] = node.Get();
2298 nodeIndexMap[node.Get()] = index;
2299 }
2300 public override void Visit(UnaryMinusNode& unaryMinusNode)
2301 {
2302 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(UnaryMinusNode)));
2303 unaryMinusNode.Subject()->Accept(*this);
2304 treeViewNode->AddChild(node.Release());
2305 node.Reset(treeViewNode.Release());
2306 node->SetData(&unaryMinusNode);
2307 Span span = unaryMinusNode.GetSpan();
2308 lexer.ConvertExternal(span);
2309 int index = span.start;
2310 indexNodeMap[index] = node.Get();
2311 nodeIndexMap[node.Get()] = index;
2312 }
2313 public override void Visit(PrefixIncrementNode& prefixIncrementNode)
2314 {
2315 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(PrefixIncrementNode)));
2316 prefixIncrementNode.Subject()->Accept(*this);
2317 treeViewNode->AddChild(node.Release());
2318 node.Reset(treeViewNode.Release());
2319 node->SetData(&prefixIncrementNode);
2320 Span span = prefixIncrementNode.GetSpan();
2321 lexer.ConvertExternal(span);
2322 int index = span.start;
2323 indexNodeMap[index] = node.Get();
2324 nodeIndexMap[node.Get()] = index;
2325 }
2326 public override void Visit(PrefixDecrementNode& prefixDecrementNode)
2327 {
2328 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(PrefixDecrementNode)));
2329 prefixDecrementNode.Subject()->Accept(*this);
2330 treeViewNode->AddChild(node.Release());
2331 node.Reset(treeViewNode.Release());
2332 node->SetData(&prefixDecrementNode);
2333 Span span = prefixDecrementNode.GetSpan();
2334 lexer.ConvertExternal(span);
2335 int index = span.start;
2336 indexNodeMap[index] = node.Get();
2337 nodeIndexMap[node.Get()] = index;
2338 }
2339 public override void Visit(DerefNode& derefNode)
2340 {
2341 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(DerefNode)));
2342 derefNode.Subject()->Accept(*this);
2343 treeViewNode->AddChild(node.Release());
2344 node.Reset(treeViewNode.Release());
2345 node->SetData(&derefNode);
2346 Span span = derefNode.GetSpan();
2347 lexer.ConvertExternal(span);
2348 int index = span.start;
2349 indexNodeMap[index] = node.Get();
2350 nodeIndexMap[node.Get()] = index;
2351 }
2352 public override void Visit(AddrOfNode& addrOfNode)
2353 {
2354 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AddrOfNode)));
2355 addrOfNode.Subject()->Accept(*this);
2356 treeViewNode->AddChild(node.Release());
2357 node.Reset(treeViewNode.Release());
2358 node->SetData(&addrOfNode);
2359 Span span = addrOfNode.GetSpan();
2360 lexer.ConvertExternal(span);
2361 int index = span.start;
2362 indexNodeMap[index] = node.Get();
2363 nodeIndexMap[node.Get()] = index;
2364 }
2365 public override void Visit(ComplementNode& complementNode)
2366 {
2367 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ComplementNode)));
2368 complementNode.Subject()->Accept(*this);
2369 treeViewNode->AddChild(node.Release());
2370 node.Reset(treeViewNode.Release());
2371 node->SetData(&complementNode);
2372 Span span = complementNode.GetSpan();
2373 lexer.ConvertExternal(span);
2374 int index = span.start;
2375 indexNodeMap[index] = node.Get();
2376 nodeIndexMap[node.Get()] = index;
2377 }
2378 public override void Visit(IsNode& isNode)
2379 {
2380 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(IsNode)));
2381 isNode.Expr()->Accept(*this);
2382 treeViewNode->AddChild(node.Release());
2383 isNode.TargetTypeExpr()->Accept(*this);
2384 treeViewNode->AddChild(node.Release());
2385 node.Reset(treeViewNode.Release());
2386 node->SetData(&isNode);
2387 Span span = isNode.GetSpan();
2388 lexer.ConvertExternal(span);
2389 int index = span.start;
2390 indexNodeMap[index] = node.Get();
2391 nodeIndexMap[node.Get()] = index;
2392 }
2393 public override void Visit(AsNode& asNode)
2394 {
2395 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AsNode)));
2396 asNode.Expr()->Accept(*this);
2397 treeViewNode->AddChild(node.Release());
2398 asNode.TargetTypeExpr()->Accept(*this);
2399 treeViewNode->AddChild(node.Release());
2400 node.Reset(treeViewNode.Release());
2401 node->SetData(&asNode);
2402 Span span = asNode.GetSpan();
2403 lexer.ConvertExternal(span);
2404 int index = span.start;
2405 indexNodeMap[index] = node.Get();
2406 nodeIndexMap[node.Get()] = index;
2407 }
2408 public override void Visit(IndexingNode& indexingNode)
2409 {
2410 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(IndexingNode)));
2411 indexingNode.Subject()->Accept(*this);
2412 treeViewNode->AddChild(node.Release());
2413 indexingNode.Index()->Accept(*this);
2414 treeViewNode->AddChild(node.Release());
2415 node.Reset(treeViewNode.Release());
2416 node->SetData(&indexingNode);
2417 Span span = indexingNode.GetSpan();
2418 lexer.ConvertExternal(span);
2419 int index = span.start;
2420 indexNodeMap[index] = node.Get();
2421 nodeIndexMap[node.Get()] = index;
2422 }
2423 public override void Visit(InvokeNode& invokeNode)
2424 {
2425 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(InvokeNode)));
2426 invokeNode.Subject()->Accept(*this);
2427 treeViewNode->AddChild(node.Release());
2428 int n = invokeNode.Arguments().Count();
2429 for (int i = 0; i < n; ++i;)
2430 {
2431 invokeNode.Arguments()[i]->Accept(*this);
2432 treeViewNode->AddChild(node.Release());
2433 }
2434 node.Reset(treeViewNode.Release());
2435 node->SetData(&invokeNode);
2436 Span span = invokeNode.GetSpan();
2437 lexer.ConvertExternal(span);
2438 int index = span.start;
2439 indexNodeMap[index] = node.Get();
2440 nodeIndexMap[node.Get()] = index;
2441 }
2442 public override void Visit(PostfixIncrementNode& postfixIncrementNode)
2443 {
2444 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(PostfixIncrementNode)));
2445 postfixIncrementNode.Subject()->Accept(*this);
2446 treeViewNode->AddChild(node.Release());
2447 node.Reset(treeViewNode.Release());
2448 node->SetData(&postfixIncrementNode);
2449 Span span = postfixIncrementNode.GetSpan();
2450 lexer.ConvertExternal(span);
2451 int index = span.start;
2452 indexNodeMap[index] = node.Get();
2453 nodeIndexMap[node.Get()] = index;
2454 }
2455 public override void Visit(PostfixDecrementNode& postfixDecrementNode)
2456 {
2457 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(PostfixDecrementNode)));
2458 postfixDecrementNode.Subject()->Accept(*this);
2459 treeViewNode->AddChild(node.Release());
2460 node.Reset(treeViewNode.Release());
2461 node->SetData(&postfixDecrementNode);
2462 Span span = postfixDecrementNode.GetSpan();
2463 lexer.ConvertExternal(span);
2464 int index = span.start;
2465 indexNodeMap[index] = node.Get();
2466 nodeIndexMap[node.Get()] = index;
2467 }
2468 public override void Visit(SizeOfNode& sizeOfNode)
2469 {
2470 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(SizeOfNode)));
2471 sizeOfNode.Expression()->Accept(*this);
2472 treeViewNode->AddChild(node.Release());
2473 node.Reset(treeViewNode.Release());
2474 node->SetData(&sizeOfNode);
2475 Span span = sizeOfNode.GetSpan();
2476 lexer.ConvertExternal(span);
2477 int index = span.start;
2478 indexNodeMap[index] = node.Get();
2479 nodeIndexMap[node.Get()] = index;
2480 }
2481 public override void Visit(TypeNameNode& typeNameNode)
2482 {
2483 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TypeNameNode)));
2484 typeNameNode.Expression()->Accept(*this);
2485 treeViewNode->AddChild(node.Release());
2486 node.Reset(treeViewNode.Release());
2487 node->SetData(&typeNameNode);
2488 Span span = typeNameNode.GetSpan();
2489 lexer.ConvertExternal(span);
2490 int index = span.start;
2491 indexNodeMap[index] = node.Get();
2492 nodeIndexMap[node.Get()] = index;
2493 }
2494 public override void Visit(TypeIdNode& typeIdNode)
2495 {
2496 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(TypeIdNode)));
2497 typeIdNode.Expression()->Accept(*this);
2498 treeViewNode->AddChild(node.Release());
2499 node.Reset(treeViewNode.Release());
2500 node->SetData(&typeIdNode);
2501 Span span = typeIdNode.GetSpan();
2502 lexer.ConvertExternal(span);
2503 int index = span.start;
2504 indexNodeMap[index] = node.Get();
2505 nodeIndexMap[node.Get()] = index;
2506 }
2507 public override void Visit(CastNode& castNode)
2508 {
2509 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CastNode)));
2510 castNode.TargetTypeExpr()->Accept(*this);
2511 treeViewNode->AddChild(node.Release());
2512 castNode.SourceExpr()->Accept(*this);
2513 treeViewNode->AddChild(node.Release());
2514 node.Reset(treeViewNode.Release());
2515 node->SetData(&castNode);
2516 Span span = castNode.GetSpan();
2517 lexer.ConvertExternal(span);
2518 int index = span.start;
2519 indexNodeMap[index] = node.Get();
2520 nodeIndexMap[node.Get()] = index;
2521 }
2522 public override void Visit(ConstructNode& constructNode)
2523 {
2524 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ConstructNode)));
2525 constructNode.TypeExpr()->Accept(*this);
2526 treeViewNode->AddChild(node.Release());
2527 int n = constructNode.Arguments().Count();
2528 for (int i = 0; i < n; ++i;)
2529 {
2530 constructNode.Arguments()[i]->Accept(*this);
2531 treeViewNode->AddChild(node.Release());
2532 }
2533 node.Reset(treeViewNode.Release());
2534 node->SetData(&constructNode);
2535 Span span = constructNode.GetSpan();
2536 lexer.ConvertExternal(span);
2537 int index = span.start;
2538 indexNodeMap[index] = node.Get();
2539 nodeIndexMap[node.Get()] = index;
2540 }
2541 public override void Visit(NewNode& newNode)
2542 {
2543 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(NewNode)));
2544 newNode.TypeExpr()->Accept(*this);
2545 treeViewNode->AddChild(node.Release());
2546 int n = newNode.Arguments().Count();
2547 for (int i = 0; i < n; ++i;)
2548 {
2549 newNode.Arguments()[i]->Accept(*this);
2550 treeViewNode->AddChild(node.Release());
2551 }
2552 node.Reset(treeViewNode.Release());
2553 node->SetData(&newNode);
2554 Span span = newNode.GetSpan();
2555 lexer.ConvertExternal(span);
2556 int index = span.start;
2557 indexNodeMap[index] = node.Get();
2558 nodeIndexMap[node.Get()] = index;
2559 }
2560 public override void Visit(ThisNode& thisNode)
2561 {
2562 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ThisNode)));
2563 node.Reset(treeViewNode.Release());
2564 node->SetData(&thisNode);
2565 Span span = thisNode.GetSpan();
2566 lexer.ConvertExternal(span);
2567 int index = span.start;
2568 indexNodeMap[index] = node.Get();
2569 nodeIndexMap[node.Get()] = index;
2570 }
2571 public override void Visit(BaseNode& baseNode)
2572 {
2573 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(BaseNode)));
2574 node.Reset(treeViewNode.Release());
2575 node->SetData(&baseNode);
2576 Span span = baseNode.GetSpan();
2577 lexer.ConvertExternal(span);
2578 int index = span.start;
2579 indexNodeMap[index] = node.Get();
2580 nodeIndexMap[node.Get()] = index;
2581 }
2582 public override void Visit(ParenthesizedExpressionNode& parenthesizedExpressionNode)
2583 {
2584 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(ParenthesizedExpressionNode)));
2585 parenthesizedExpressionNode.Subject()->Accept(*this);
2586 treeViewNode->AddChild(node.Release());
2587 node.Reset(treeViewNode.Release());
2588 node->SetData(&parenthesizedExpressionNode);
2589 Span span = parenthesizedExpressionNode.GetSpan();
2590 lexer.ConvertExternal(span);
2591 int index = span.start;
2592 indexNodeMap[index] = node.Get();
2593 nodeIndexMap[node.Get()] = index;
2594 }
2595 public override void Visit(GlobalVariableNode& globalVariableNode)
2596 {
2597 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(GlobalVariableNode)));
2598 globalVariableNode.TypeExpr()->Accept(*this);
2599 treeViewNode->AddChild(node.Release());
2600 globalVariableNode.Id()->Accept(*this);
2601 treeViewNode->AddChild(node.Release());
2602 if (globalVariableNode.Initializer() != null)
2603 {
2604 globalVariableNode.Initializer()->Accept(*this);
2605 treeViewNode->AddChild(node.Release());
2606 }
2607 node.Reset(treeViewNode.Release());
2608 node->SetData(&globalVariableNode);
2609 Span span = globalVariableNode.GetSpan();
2610 lexer.ConvertExternal(span);
2611 int index = span.start;
2612 indexNodeMap[index] = node.Get();
2613 nodeIndexMap[node.Get()] = index;
2614 }
2615 public override void Visit(AttributeNode& attribute)
2616 {
2617 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AttributeNode)));
2618 node.Reset(treeViewNode.Release());
2619 node->SetData(&attribute);
2620 Span span = attribute.GetSpan();
2621 lexer.ConvertExternal(span);
2622 int index = span.start;
2623 indexNodeMap[index] = node.Get();
2624 nodeIndexMap[node.Get()] = index;
2625 }
2626 public override void Visit(AttributesNode& attributes)
2627 {
2628 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(AttributesNode)));
2629 long n = attributes.GetAttributes().Count();
2630 for (long i = 0; i < n; ++i;)
2631 {
2632 attributes.GetAttributes()[i]->Accept(*this);
2633 treeViewNode->AddChild(node.Release());
2634 }
2635 node.Reset(treeViewNode.Release());
2636 node->SetData(&attributes);
2637 Span span = attributes.GetSpan();
2638 lexer.ConvertExternal(span);
2639 int index = span.start;
2640 indexNodeMap[index] = node.Get();
2641 nodeIndexMap[node.Get()] = index;
2642 }
2643 public override void Visit(CommentNode& commentNode)
2644 {
2645 UniquePtr<TreeViewNode> treeViewNode(new TreeViewNode(typename(CommentNode)));
2646 node.Reset(treeViewNode.Release());
2647 node->SetData(&commentNode);
2648 Span span = commentNode.GetSpan();
2649 lexer.ConvertExternal(span);
2650 int index = span.start;
2651 indexNodeMap[index] = node.Get();
2652 nodeIndexMap[node.Get()] = index;
2653 }
2654 private CmajorLexer& lexer;
2655 private UniquePtr<TreeViewNode> node;
2656 private HashMap<int, TreeViewNode*> indexNodeMap;
2657 private HashMap<TreeViewNode*, int> nodeIndexMap;
2658 }