Skip to content

Commit 11f5ea5

Browse files
committed
Improve code quality
1 parent 6462023 commit 11f5ea5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
4-
using System.Linq;
54
using System.Runtime.InteropServices;
65
using System.Text.RegularExpressions;
76
using System.Windows.Controls;
@@ -16,8 +15,7 @@ public class Main : IPlugin, IPluginI18n, ISettingProvider
1615
private static readonly Regex RegBrackets = MainRegexHelper.GetRegBrackets();
1716
private static readonly Regex ThousandGroupRegex = MainRegexHelper.GetThousandGroupRegex();
1817
private static readonly Regex NumberRegex = MainRegexHelper.GetNumberRegex();
19-
private static readonly Regex PowRegex = new(@"\bpow(\((?:[^()\[\]]|\((?<Depth>)|\)(?<-Depth>)|\[(?<Depth>)|\](?<-Depth>))*(?(Depth)(?!))\))", RegexOptions.Compiled | RegexOptions.RightToLeft);
20-
18+
private static readonly Regex PowRegex = MainRegexHelper.GetPowRegex();
2119

2220
private static Engine MagesEngine;
2321
private const string Comma = ",";
@@ -200,7 +198,7 @@ private static string PowMatchEvaluator(Match m)
200198
/// Parses a string representation of a number using the system's current culture.
201199
/// </summary>
202200
/// <returns>A normalized number string with '.' as the decimal separator for the Mages engine.</returns>
203-
private string NormalizeNumber(string numberStr)
201+
private static string NormalizeNumber(string numberStr)
204202
{
205203
var culture = CultureInfo.CurrentCulture;
206204
var groupSep = culture.NumberFormat.NumberGroupSeparator;

Plugins/Flow.Launcher.Plugin.Calculator/MainRegexHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace Flow.Launcher.Plugin.Calculator;
44

55
internal static partial class MainRegexHelper
66
{
7-
87
[GeneratedRegex(@"[\(\)\[\]]", RegexOptions.Compiled)]
98
public static partial Regex GetRegBrackets();
109

@@ -13,4 +12,7 @@ internal static partial class MainRegexHelper
1312

1413
[GeneratedRegex(@"\B(?=(\d{3})+(?!\d))", RegexOptions.Compiled)]
1514
public static partial Regex GetThousandGroupRegex();
15+
16+
[GeneratedRegex(@"\bpow(\((?:[^()\[\]]|\((?<Depth>)|\)(?<-Depth>)|\[(?<Depth>)|\](?<-Depth>))*(?(Depth)(?!))\))", RegexOptions.Compiled | RegexOptions.RightToLeft)]
17+
public static partial Regex GetPowRegex();
1618
}

0 commit comments

Comments
 (0)