Skip to content

Commit

Permalink
Version 0.1.26. Added support for translation functions inside functi…
Browse files Browse the repository at this point in the history
…ons.
  • Loading branch information
Konard committed Feb 16, 2020
1 parent e366091 commit 16ca266
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ public class CSharpToCppTransformer : Transformer
// Count => GetSizeOrZero(Root);
// GetCount() { return GetSizeOrZero(Root); }
(new Regex(@"(\W)([A-Z][a-zA-Z]+)\s+=>\s+([^;\r\n]+);"), "$1Get$2() { return $3; }", null, 0),
// ArgumentInRange(const char* message) { const char* messageBuilder() { return message; }
// ArgumentInRange(const char* message) { auto messageBuilder = [&]() -> const char* { return message; };
(new Regex(@"(?<before>\W[_a-zA-Z0-9]+\([^\)\n]*\)[\s\n]*{[\s\n]*([^{}]|\n)*?(\r?\n)?[ \t]*)(?<returnType>[_a-zA-Z0-9*:]+[_a-zA-Z0-9*: ]*) (?<methodName>[_a-zA-Z0-9]+)\((?<arguments>[^\)\n]*)\)\s*{(?<body>([^}]|\n)+?)}"), "${before}auto ${methodName} = [&]() -> ${returnType} {${body}};", null, 10),
// Func<TElement> treeCount
// std::function<TElement()> treeCount
(new Regex(@"Func<([a-zA-Z0-9]+)> ([a-zA-Z0-9]+)"), "std::function<$1()> $2", null, 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>LinksPlatform's Platform.RegularExpressions.Transformer.CSharpToCpp Class Library</Description>
<Copyright>Konstantin Diachenko</Copyright>
<AssemblyTitle>Platform.RegularExpressions.Transformer.CSharpToCpp</AssemblyTitle>
<VersionPrefix>0.1.25</VersionPrefix>
<VersionPrefix>0.1.26</VersionPrefix>
<Authors>Konstantin Diachenko</Authors>
<TargetFrameworks>net471;netstandard2.0;netstandard2.1</TargetFrameworks>
<AssemblyName>Platform.RegularExpressions.Transformer.CSharpToCpp</AssemblyName>
Expand All @@ -24,7 +24,7 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<LangVersion>latest</LangVersion>
<PackageReleaseNotes>Better support for exceptions translation.</PackageReleaseNotes>
<PackageReleaseNotes>Added support for translation functions inside functions.</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
Expand Down

0 comments on commit 16ca266

Please sign in to comment.