@@ -937,7 +937,7 @@ Expression ParseIntegerLiteral()
937937 bool isHexadecimal = text . StartsWith ( text [ 0 ] == '-' ? "-0x" : "0x" , StringComparison . CurrentCultureIgnoreCase ) ;
938938 char [ ] qualifierLetters = isHexadecimal
939939 ? 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' } ;
941941
942942 if ( qualifierLetters . Contains ( last ) )
943943 {
@@ -1007,6 +1007,9 @@ Expression ParseIntegerLiteral()
10071007 if ( qualifier == "D" || qualifier == "d" )
10081008 return TryParseAsDouble ( text , qualifier [ 0 ] ) ;
10091009
1010+ if ( qualifier == "M" || qualifier == "m" )
1011+ return TryParseAsDecimal ( text , qualifier [ 0 ] ) ;
1012+
10101013 throw ParseError ( Res . MinusCannotBeAppliedToUnsignedInteger ) ;
10111014 }
10121015
@@ -1038,6 +1041,21 @@ Expression TryParseAsFloat(string text, char qualifier)
10381041 }
10391042 }
10401043
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+
10411059 // not possible to find float qualifier, so try to parse as double
10421060 return TryParseAsDouble ( text , qualifier ) ;
10431061 }
0 commit comments