Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2003-11-07 00:49:29 +0300
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2003-11-07 00:49:29 +0300
commit924547505befbc3ba46e0be3ccfb532b7367fdd5 (patch)
tree9082e8dbc1725c1c05c5adc5dacf1de89696e5e4 /mcs/class/System/Microsoft.VisualBasic
parent69a687539a45731fcaa77f8d6cdfb9bd5a300b52 (diff)
2003-11-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* VBCodeGenerator.cs: some corrections regarding missing spaces in generated code (e. g. "Property "). QuoteSnippetString implemented. Patch by Jochen Wezel (jwezel@compumaster.de). svn path=/trunk/mcs/; revision=19697
Diffstat (limited to 'mcs/class/System/Microsoft.VisualBasic')
-rw-r--r--mcs/class/System/Microsoft.VisualBasic/ChangeLog15
-rw-r--r--mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs49
2 files changed, 55 insertions, 9 deletions
diff --git a/mcs/class/System/Microsoft.VisualBasic/ChangeLog b/mcs/class/System/Microsoft.VisualBasic/ChangeLog
index 78a7034bab1..f22797e0a30 100644
--- a/mcs/class/System/Microsoft.VisualBasic/ChangeLog
+++ b/mcs/class/System/Microsoft.VisualBasic/ChangeLog
@@ -1,11 +1,20 @@
+2003-11-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * VBCodeGenerator.cs: some corrections regarding missing spaces in
+ generated code (e. g. "Property "). QuoteSnippetString implemented.
+ Patch by Jochen Wezel (jwezel@compumaster.de).
+
2003-10-17 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
- * Microsoft.VisualBasic/VBCodeGenerator.cs: Sub or Function generation is switched by method.ReturnType being "System.Void"
+ * Microsoft.VisualBasic/VBCodeGenerator.cs: Sub or Function generation
+ is switched by method.ReturnType being "System.Void"
2003-10-17 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
- * Microsoft.VisualBasic/VBCodeCompiler.cs: Inserts "--" before file names block
- * Microsoft.VisualBasic/VBCodeGenerator.cs: Indexer should be ".Item(xx)"
+ * Microsoft.VisualBasic/VBCodeCompiler.cs: Inserts "--" before file
+ names block
+ * Microsoft.VisualBasic/VBCodeGenerator.cs: Indexer should be
+ ".Item(xx)"
2003-10-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
diff --git a/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs b/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
index b59fe15787f..6da964e3232 100644
--- a/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
+++ b/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
@@ -4,8 +4,10 @@
// Author:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
// (partially based on CSharpCodeGenerator)
+// Jochen Wezel (jwezel@compumaster.de)
//
// (C) 2003 Andreas Nahr
+// (C) 2003 Jochen Wezel
//
using System;
@@ -619,10 +621,10 @@ namespace Microsoft.VisualBasic
OutputMemberScopeModifier (attributes);
if (property.HasGet && (property.HasSet = false))
- output.Write ("ReadOnly" );
+ output.Write ("ReadOnly " );
if (property.HasSet && (property.HasGet = false))
- output.Write ("WriteOnly" );
+ output.Write ("WriteOnly " );
output.Write ("Property" );
@@ -951,7 +953,7 @@ namespace Microsoft.VisualBasic
output.Write ("Protected ");
break;
case TypeAttributes.NestedFamORAssem:
- output.Write ("Protected Friend");
+ output.Write ("Protected Friend ");
break;
case TypeAttributes.NestedFamANDAssem:
output.Write ("Friend ");
@@ -990,11 +992,46 @@ namespace Microsoft.VisualBasic
Output.Write (GetTypeOutput (type));
}
- [MonoTODO ("not implemented")]
protected override string QuoteSnippetString (string value)
{
- // FIXME: escape ASCII chars that are not code compatible (e.g. vbcrlf)
- return value;
+ StringBuilder mySBuilder = new StringBuilder(value.Length);
+ mySBuilder.Append ("\"");
+ bool inQuotes = true;
+ for (int MyCounter = 0; MyCounter < value.Length; MyCounter++)
+ {
+ if (value[MyCounter] == 34) //quotation mark
+ {
+ if (!inQuotes)
+ {
+ mySBuilder.Append ("&\"");
+ inQuotes = true;
+ }
+ mySBuilder.Append (value[MyCounter]);
+ mySBuilder.Append (value[MyCounter]);
+ }
+ else if (value[MyCounter] >= 32) //standard ansi/unicode characters
+ {
+ if (!inQuotes)
+ {
+ mySBuilder.Append ("&\"");
+ inQuotes = true;
+ }
+ mySBuilder.Append (value[MyCounter]);
+ }
+ else //special chars, e.g. line break
+ {
+ if (inQuotes)
+ {
+ mySBuilder.Append ("\"");
+ inQuotes = false;
+ }
+ mySBuilder.Append ("&Microsoft.VisualBasic.ChrW(");
+ mySBuilder.Append ((int)value[MyCounter]);
+ mySBuilder.Append (")");
+ }
+ }
+ mySBuilder.Append ("\"");
+ return mySBuilder.ToString();
}
private void GenerateDeclaration (CodeTypeReference type, string name, CodeExpression initExpression)