@@ -29,8 +29,6 @@ public partial class ExpressionEvaluator
29
29
{
30
30
#region Regex declarations
31
31
32
- protected const string primaryTypesRegexPattern = @"(?<=^|[^\p{L}_])(?<primaryType>object|string|bool[?]?|byte[?]?|char[?]?|decimal[?]?|double[?]?|short[?]?|int[?]?|long[?]?|sbyte[?]?|float[?]?|ushort[?]?|uint[?]?|ulong[?]?|void)(?=[^a-zA-Z_]|$)" ;
33
-
34
32
protected static readonly Regex varOrFunctionRegEx = new Regex ( @"^((?<sign>[+-])|(?<prefixOperator>[+][+]|--)|(?<varKeyword>var)\s+|(?<dynamicKeyword>dynamic)\s+|((?<nullConditional>[?])?(?<inObject>\.))?)(?<name>[\p{L}_](?>[\p{L}_0-9]*))(?>\s*)((?<assignationOperator>(?<assignmentPrefix>[+\-*/%&|^]|<<|>>|\?\?)?=(?![=>]))|(?<postfixOperator>([+][+]|--)(?![\p{L}_0-9]))|((?<isgeneric>[<](?>([\p{L}_](?>[\p{L}_0-9]*)|(?>\s+)|[,\.])+|(?<gentag>[<])|(?<-gentag>[>]))*(?(gentag)(?!))[>])?(?<isfunction>[(])?))" , RegexOptions . IgnoreCase | RegexOptions . Compiled ) ;
35
33
36
34
protected const string numberRegexOrigPattern = @"^(?<sign>[+-])?([0-9][0-9_{1}]*[0-9]|\d)(?<hasdecimal>{0}?([0-9][0-9_]*[0-9]|\d)(e[+-]?([0-9][0-9_]*[0-9]|\d))?)?(?<type>ul|[fdulm])?" ;
@@ -3929,6 +3927,11 @@ protected virtual Type GetTypeByFriendlyName(string typeName, string genericType
3929
3927
typeName = typeName . Replace ( " " , "" ) . Replace ( "\t " , "" ) . Replace ( "\r " , "" ) . Replace ( "\n " , "" ) ;
3930
3928
genericTypes = genericTypes . Replace ( " " , "" ) . Replace ( "\t " , "" ) . Replace ( "\r " , "" ) . Replace ( "\n " , "" ) ;
3931
3929
3930
+ if ( primaryTypesDict . ContainsKey ( OptionCaseSensitiveEvaluationActive ? typeName : typeName . ToLower ( ) ) )
3931
+ {
3932
+ result = primaryTypesDict [ OptionCaseSensitiveEvaluationActive ? typeName : typeName . ToLower ( ) ] ;
3933
+ }
3934
+
3932
3935
if ( CacheTypesResolutions && ( TypesResolutionCaching ? . ContainsKey ( typeName + genericTypes ) ?? false ) )
3933
3936
{
3934
3937
result = TypesResolutionCaching [ typeName + genericTypes ] ;
@@ -3946,14 +3949,6 @@ protected virtual Type GetTypeByFriendlyName(string typeName, string genericType
3946
3949
result = Type . GetType ( typeName + formatedGenericTypes , false , ! OptionCaseSensitiveEvaluationActive ) ;
3947
3950
}
3948
3951
3949
- if ( result == null )
3950
- {
3951
- typeName = Regex . Replace ( typeName , primaryTypesRegexPattern ,
3952
- ( Match match ) => primaryTypesDict [ OptionCaseSensitiveEvaluationActive ? match . Value : match . Value . ToLower ( ) ] . ToString ( ) , optionCaseSensitiveEvaluationActive ? RegexOptions . None : RegexOptions . IgnoreCase ) ;
3953
-
3954
- result = Type . GetType ( typeName , false , ! OptionCaseSensitiveEvaluationActive ) ;
3955
- }
3956
-
3957
3952
if ( result == null )
3958
3953
{
3959
3954
result = Types . ToList ( ) . Find ( type => type . Name . Equals ( typeName , StringComparisonForCasing ) || type . FullName . StartsWith ( typeName + "," ) ) ;
0 commit comments