@@ -100,6 +100,9 @@ public class CSharpToCppTransformer : TextTransformer
100100 // (this
101101 // (
102102 ( new Regex ( @"\(this " ) , "(" , 0 ) ,
103+ // private: static readonly Disposal _emptyDelegate = (manual, wasDisposed) => { };
104+ // private: inline static std::function<Disposal> _emptyDelegate = [](auto manual, auto wasDisposed) { };
105+ ( new Regex ( @"(?<access>(private|protected|public): )?static readonly (?<type>[a-zA-Z][a-zA-Z0-9]*) (?<name>[a-zA-Z_][a-zA-Z0-9_]*) = \((?<firstArgument>[a-zA-Z_][a-zA-Z0-9_]*), (?<secondArgument>[a-zA-Z_][a-zA-Z0-9_]*)\) => {\s*};" ) , "${access}inline static std::function<${type}> ${name} = [](auto ${firstArgument}, auto ${secondArgument}) { };" , 0 ) ,
103106 // public: static readonly EnsureAlwaysExtensionRoot Always = new EnsureAlwaysExtensionRoot();
104107 // public: inline static EnsureAlwaysExtensionRoot Always;
105108 ( 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>\(\);" ) , "${access}inline static ${type} ${name};" , 0 ) ,
@@ -139,6 +142,9 @@ public class CSharpToCppTransformer : TextTransformer
139142 // int SizeBalancedTree(int capacity) => a;
140143 // int SizeBalancedTree(int capacity) { return a; }
141144 ( new Regex ( @"(^\s+)(private|protected|public)?(: )?(template \<[^>\r\n]+\> )?(static )?(override )?([a-zA-Z0-9]+ )([a-zA-Z0-9]+)\(([^\(\r\n]*)\)\s+=>\s+([^;\r\n]+);" ) , "$1$2$3$4$5$6$7$8($9) { return $10; }" , 0 ) ,
145+ // OnDispose = (manual, wasDisposed) =>
146+ // OnDispose = [&](auto manual, auto wasDisposed)
147+ ( new Regex ( @"(?<variable>[a-zA-Z_][a-zA-Z0-9_]*)(?<operator>\s*=\s*)\((?<firstArgument>[a-zA-Z_][a-zA-Z0-9_]*), (?<secondArgument>[a-zA-Z_][a-zA-Z0-9_]*)\)\s*=>" ) , "${variable}${operator}[&](auto ${firstArgument}, auto ${secondArgument})" , 0 ) ,
142148 // () => Integer<TElement>.Zero,
143149 // () { return Integer<TElement>.Zero; },
144150 ( new Regex ( @"\(\)\s+=>\s+(?<expression>[^(),;\r\n]+(\(((?<parenthesis>\()|(?<-parenthesis>\))|[^();\r\n]*?)*?\))?[^(),;\r\n]*)(?<after>,|\);)" ) , "() { return ${expression}; }${after}" , 0 ) ,
0 commit comments