Skip to content

Commit 6553a15

Browse files
author
Sébastien Geiser
committed
Modification of internalCharRegex to avoid conflict with Culture dependant number separators as ' (single quote)
1 parent 7cd8a74 commit 6553a15

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,6 @@ public static IEnumerable<TestCaseData> TestCasesEvaluateWithSpecificEvaluator
14541454
{
14551455
OptionNumberParsingDecimalSeparator = ",",
14561456
OptionNumberParsingThousandSeparator = "'",
1457-
OptionCharEvaluationActive = false,
14581457
OptionFunctionArgumentsSeparator = ";"
14591458
}
14601459
, "Max(1'200,5; 1'111'000,7)")
@@ -1466,7 +1465,6 @@ public static IEnumerable<TestCaseData> TestCasesEvaluateWithSpecificEvaluator
14661465
{
14671466
OptionNumberParsingDecimalSeparator = ",",
14681467
OptionNumberParsingThousandSeparator = "'",
1469-
OptionCharEvaluationActive = false,
14701468
OptionInitializersSeparator = ";"
14711469
}
14721470
, "new double[]{1'200,5; 1'111'000,7}.Max()")

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class ExpressionEvaluator
3838

3939
private static readonly Regex otherBasesNumberRegex = new Regex(@"^(?<sign>[+-])?(?<value>0(?<type>x)([0-9a-f][0-9a-f_]*[0-9a-f]|[0-9a-f])|0(?<type>b)([01][01_]*[01]|[01]))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
4040
private static readonly Regex stringBeginningRegex = new Regex("^(?<interpolated>[$])?(?<escaped>[@])?[\"]", RegexOptions.Compiled);
41-
private static readonly Regex internalCharRegex = new Regex(@"^['](\\[']|[^'])*[']", RegexOptions.Compiled);
41+
private static readonly Regex internalCharRegex = new Regex(@"^['](\\[\\'0abfnrtv]|[^'])[']", RegexOptions.Compiled);
4242
private static readonly Regex indexingBeginningRegex = new Regex(@"^[?]?\[", RegexOptions.Compiled);
4343
private static readonly Regex assignationOrPostFixOperatorRegex = new Regex(@"^\s*((?<assignmentPrefix>[+\-*/%&|^]|<<|>>)?=(?![=>])|(?<postfixOperator>([+][+]|--)(?![" + diactiticsKeywordsRegexPattern + @"0-9])))");
4444
private static readonly Regex genericsDecodeRegex = new Regex("(?<name>[^,<>]+)(?<isgeneric>[<](?>[^<>]+|(?<gentag>[<])|(?<-gentag>[>]))*(?(gentag)(?!))[>])?", RegexOptions.Compiled);

0 commit comments

Comments
 (0)