cbc3f6ca8f1f0d4c92dc1127018abc0a73286b13
[mono.git] / mcs / tools / type-reflector / formatters / VBNodeFormatter.cs
1 //
2 // VBNodeFormatter.cs: Formats nodes with VB.NET syntax
3 //
4 // Author: Jonathan Pryor (jonpryor@vt.edu)
5 //
6 // (C) 2002 Jonathan Pryor
7 //
8
9 using System;
10 using System.Collections;
11 using System.IO;
12 using System.Diagnostics;
13 using System.Reflection;
14 using System.Text;
15 using System.Text.RegularExpressions;
16
17 namespace Mono.TypeReflector.Formatters
18 {
19         public class VBNodeFormatter : LanguageNodeFormatter {
20
21                 public VBNodeFormatter ()
22                 {
23                 }
24
25                 protected override string LineComment       {get {return "'";}}
26
27                 protected override string KeywordClass      {get {return "Class";}}
28                 protected override string KeywordEnum       {get {return "Enum";}}
29                 protected override string KeywordValueType  {get {return "Struct";}}
30                 protected override string KeywordInterface  {get {return "Interface";}}
31                 protected override string KeywordInherits   {get {return "Inherits";}}
32                 protected override string KeywordImplements {get {return "Implements";}}
33                 protected override string KeywordMulticast  {get {return "Event";}}
34                 protected override string KeywordStatementTerminator {get {return "";}}
35                 protected override string KeywordStatementSeparator  {get {return ",";}}
36
37                 protected override string QualifierPublic   {get {return "Public";}}
38                 protected override string QualifierFamily   {get {return "Family";}}
39                 protected override string QualifierAssembly {get {return "Internal";}}
40                 protected override string QualifierPrivate  {get {return "Private";}}
41                 protected override string QualifierFinal    {get {return "Final";}}
42                 protected override string QualifierStatic   {get {return "Shared";}}
43                 protected override string QualifierLiteral  {get {return "Const";}}
44                 protected override string QualifierAbstract {get {return "Abstract";}}
45                 protected override string QualifierVirtual  {get {return "Overridable";}}
46
47                 private static readonly string[] attributeDelimeters = new string[]{"<", ">"};
48
49                 protected override string[] AttributeDelimeters {
50                         get {return attributeDelimeters;}
51                 }
52
53                 protected override string GetConstructorName (ConstructorInfo ctor)
54                 {
55       return "Sub New";
56                 }
57
58                 protected override void AddMethodDeclaration (StringBuilder sb, MethodInfo method)
59                 {
60                         string type = "Function";
61
62                         bool sub = method.ReturnType == typeof (void);
63
64                         if (sub) {
65                                 type = "Sub";
66                         }
67
68                         sb.AppendFormat ("{0} {1}", type, method.Name);
69                         AddMethodArgs (sb, method);
70
71                         if (!sub)
72                                 sb.AppendFormat (" As {0}", method.ReturnType);
73                 }
74         }
75 }
76