Skip to content

Commit 6f591dd

Browse files
committed
Added rules for better exceptions translation.
1 parent fa7f632 commit 6f591dd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Platform.RegularExpressions.Transformer.CSharpToCpp/CSharpToCppTransformer.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ public class CSharpToCppTransformer : Transformer
123123
// printf("...\n")
124124
(new Regex(@"Console\.WriteLine\(""([^""\r\n]+)""\)"), "printf(\"$1\\n\")", null, 0),
125125
// throw new InvalidOperationException
126-
// throw std::exception
127-
(new Regex(@"throw new (InvalidOperationException|Exception)"), "throw std::exception", null, 0),
126+
// throw std::runtime_error
127+
(new Regex(@"throw new (InvalidOperationException|Exception)"), "throw std::runtime_error", null, 0),
128+
// void RaiseExceptionIgnoredEvent(Exception exception)
129+
// void RaiseExceptionIgnoredEvent(const std::exception& exception)
130+
(new Regex(@"(\(|, )(System\.Exception|Exception)( |\))"), "$1const std::exception&$3", null, 0),
131+
// EventHandler<Exception>
132+
// EventHandler<std::exception>
133+
(new Regex(@"(\W)(System\.Exception|Exception)(\W)"), "$1std::exception$3", null, 0),
128134
// override void PrintNode(TElement node, StringBuilder sb, int level)
129135
// void PrintNode(TElement node, StringBuilder sb, int level) override
130136
(new Regex(@"override ([a-zA-Z0-9 \*\+]+)(\([^\)\r\n]+?\))"), "$1$2 override", null, 0),

0 commit comments

Comments
 (0)