|
11 | 11 |
|
12 | 12 | namespace Flow.Launcher.Plugin.Calculator
|
13 | 13 | {
|
14 |
| - public class Main : IPlugin, IPluginI18n, ISettingProvider |
| 14 | + public partial class Main : IPlugin, IPluginI18n, ISettingProvider |
15 | 15 | {
|
16 |
| - private static readonly Regex RegValidExpressChar = MainRegexHelper.GetRegValidExpressChar(); |
17 |
| - private static readonly Regex RegBrackets = MainRegexHelper.GetRegBrackets(); |
18 |
| - private static readonly Regex ThousandGroupRegex = new Regex(@"\B(?=(\d{3})+(?!\d))", RegexOptions.Compiled); |
19 |
| - private static readonly Regex NumberRegex = new Regex(@"[\d\.,]+", RegexOptions.Compiled); |
| 16 | + private static readonly Regex RegValidExpressChar = GetRegValidExpressChar(); |
| 17 | + private static readonly Regex RegBrackets = GetRegBrackets(); |
| 18 | + private static readonly Regex ThousandGroupRegex = GetThousandGroupRegex(); |
| 19 | + private static readonly Regex NumberRegex = GetNumberRegex(); |
| 20 | + |
| 21 | + [GeneratedRegex(@"\B(?=(\d{3})+(?!\d))", RegexOptions.Compiled)] |
| 22 | + private static partial Regex GetThousandGroupRegex(); |
| 23 | + |
| 24 | + [GeneratedRegex(@"[\(\)\[\]]", RegexOptions.Compiled)] |
| 25 | + public static partial Regex GetRegBrackets(); |
| 26 | + |
| 27 | + [GeneratedRegex(@"^(ceil|floor|exp|pi|e|max|min|det|abs|log|ln|sqrt|sin|cos|tan|arcsin|arccos|arctan|eigval|eigvec|eig|sum|polar|plot|round|sort|real|zeta|bin2dec|hex2dec|oct2dec|factorial|sign|isprime|isinfty|==|~=|&&|\|\||(?:\<|\>)=?|[ei]|[0-9]|0x[\da-fA-F]+|[\+\%\-\*\/\^\., ""]|[\(\)\|\!\[\]])+$", RegexOptions.Compiled)] |
| 28 | + public static partial Regex GetRegValidExpressChar(); |
| 29 | + [GeneratedRegex(@"[\d\.,]+", RegexOptions.Compiled)] |
| 30 | + private static partial Regex GetNumberRegex(); |
20 | 31 |
|
21 | 32 |
|
22 | 33 | private static Engine MagesEngine;
|
|
0 commit comments