Skip to content

Commit 2edc307

Browse files
committed
Rule fix. Comments fix.
1 parent f021002 commit 2edc307

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

csharp/Platform.RegularExpressions.Transformer.CSharpToCpp/CSharpToCppTransformer.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class CSharpToCppTransformer : TextTransformer
5858
//
5959
(new Regex(@"\r?\n[^\n]+bool operator !=\((?<type>[^\n]+) (?<left>[a-zA-Z0-9]+), \k<type> (?<right>[a-zA-Z0-9]+)\) => !\((\k<left>|\k<right>) == (\k<left>|\k<right>)\);"), "", 10),
6060
// public override bool Equals(object obj) => obj is Range<T> range ? Equals(range) : false;
61-
//
61+
//
6262
(new Regex(@"\r?\n[^\n]+override bool Equals\((System\.)?[Oo]bject (?<this>[a-zA-Z0-9]+)\) => \k<this> is [^\n]+ (?<other>[a-zA-Z0-9]+) \? Equals\(\k<other>\) : false;"), "", 10),
6363
// out TProduct
6464
// TProduct
@@ -108,7 +108,7 @@ public class CSharpToCppTransformer : TextTransformer
108108
(new Regex(@"(?<access>(private|protected|public): )?static readonly (?<type>[a-zA-Z0-9]+(<[a-zA-Z0-9]+>)?) (?<name>[a-zA-Z0-9_]+) = new \k<type>\((?<arguments>[^\n]+)\);"), "${access}inline static ${type} ${name} = ${type}(${arguments});", 0),
109109
// public: static readonly string ExceptionContentsSeparator = "---";
110110
// public: inline static std::string ExceptionContentsSeparator = "---";
111-
(new Regex(@"(?<access>(private|protected|public): )?(const|static readonly) string (?<name>[a-zA-Z0-9_]+) = ""(?<string>(\""|[^""\r\n])+)"";"), "${access}inline static std::string ${name} = \"${string}\";", 0),
111+
(new Regex(@"(?<access>(private|protected|public): )?(const|static readonly) string (?<name>[a-zA-Z0-9_]+) = ""(?<string>(\\""|[^""\r\n])+)"";"), "${access}inline static std::string ${name} = \"${string}\";", 0),
112112
// private: const int MaxPath = 92;
113113
// private: inline static const int MaxPath = 92;
114114
(new Regex(@"(?<access>(private|protected|public): )?(const|static readonly) (?<type>[a-zA-Z0-9]+) (?<name>[_a-zA-Z0-9]+) = (?<value>[^;\r\n]+);"), "${access}inline static const ${type} ${name} = ${value};", 0),
@@ -440,7 +440,6 @@ public class CSharpToCppTransformer : TextTransformer
440440
// Inside method bodies replace:
441441
// GetFirst(
442442
// this->GetFirst(
443-
//(new Regex(@"(?<separator>(\(|, |([\W]) |return ))(?<!(->|\* ))(?<method>(?!sizeof)[a-zA-Z0-9]+)\((?!\) \{)"), "${separator}this->${method}(", 1),
444443
(new Regex(@"(?<scope>/\*method-start\*/)(?<before>((?<!/\*method-end\*/)(.|\n))*?)(?<separator>[\W](?<!(::|\.|->|throw\s+)))(?<method>(?!sizeof)[a-zA-Z0-9]+)\((?!\) \{)(?<after>(.|\n)*?)(?<scopeEnd>/\*method-end\*/)"), "${scope}${before}${separator}this->${method}(${after}${scopeEnd}", 100),
445444
// Remove scope borders.
446445
// /*method-start*/
@@ -599,10 +598,10 @@ public class CSharpToCppTransformer : TextTransformer
599598
//
600599
(new Regex(@"(^|\r?\n)[ \t]*\#(region|endregion)[^\r\n]*(\r?\n|$)"), "", 0),
601600
// //#define ENABLE_TREE_AUTO_DEBUG_AND_VALIDATION
602-
//
601+
//
603602
(new Regex(@"\/\/[ \t]*\#define[ \t]+[_a-zA-Z0-9]+[ \t]*"), "", 0),
604603
// #if USEARRAYPOOL\r\n#endif
605-
//
604+
//
606605
(new Regex(@"#if [a-zA-Z0-9]+\s+#endif"), "", 0),
607606
// [Fact]
608607
//

0 commit comments

Comments
 (0)