@@ -937,7 +937,7 @@ Expression ParseIntegerLiteral()
937
937
bool isHexadecimal = text . StartsWith ( text [ 0 ] == '-' ? "-0x" : "0x" , StringComparison . CurrentCultureIgnoreCase ) ;
938
938
char [ ] qualifierLetters = isHexadecimal
939
939
? new [ ] { 'U' , 'u' , 'L' , 'l' }
940
- : new [ ] { 'U' , 'u' , 'L' , 'l' , 'F' , 'f' , 'D' , 'd' } ;
940
+ : new [ ] { 'U' , 'u' , 'L' , 'l' , 'F' , 'f' , 'D' , 'd' , 'M' , 'm' } ;
941
941
942
942
if ( qualifierLetters . Contains ( last ) )
943
943
{
@@ -1007,6 +1007,9 @@ Expression ParseIntegerLiteral()
1007
1007
if ( qualifier == "D" || qualifier == "d" )
1008
1008
return TryParseAsDouble ( text , qualifier [ 0 ] ) ;
1009
1009
1010
+ if ( qualifier == "M" || qualifier == "m" )
1011
+ return TryParseAsDecimal ( text , qualifier [ 0 ] ) ;
1012
+
1010
1013
throw ParseError ( Res . MinusCannotBeAppliedToUnsignedInteger ) ;
1011
1014
}
1012
1015
@@ -1038,6 +1041,21 @@ Expression TryParseAsFloat(string text, char qualifier)
1038
1041
}
1039
1042
}
1040
1043
1044
+ // not possible to find float qualifier, so try to parse as double
1045
+ return TryParseAsDecimal ( text , qualifier ) ;
1046
+ }
1047
+
1048
+ Expression TryParseAsDecimal ( string text , char qualifier )
1049
+ {
1050
+ if ( qualifier == 'M' || qualifier == 'm' )
1051
+ {
1052
+ decimal d ;
1053
+ if ( decimal . TryParse ( text . Substring ( 0 , text . Length - 1 ) , NumberStyles . Number , CultureInfo . InvariantCulture , out d ) )
1054
+ {
1055
+ return CreateLiteral ( d , text ) ;
1056
+ }
1057
+ }
1058
+
1041
1059
// not possible to find float qualifier, so try to parse as double
1042
1060
return TryParseAsDouble ( text , qualifier ) ;
1043
1061
}
0 commit comments