Author: manjula
Date: 2005-06-30 04:35:43 -0400 (Thu, 30 Jun 2005)
New Revision: 46757
Modified:
trunk/mcs/mbas/ChangeLog
trunk/mcs/mbas/mb-tokenizer.cs
Log:
Support hexadecimal literals - supports binary value of the integer literal
- like &H8000S is "-32768" and not an overflow exception
Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog 2005-06-30 07:53:32 UTC (rev 46756)
+++ trunk/mcs/mbas/ChangeLog 2005-06-30 08:35:43 UTC (rev 46757)
@@ -1,3 +1,7 @@
+2005-06-30 Manjula GHM <[EMAIL PROTECTED]>
+ *mb-tokenizer.c : Support hexadecimal literals - supports binary value
+ of the integer literal - like &H8000S is "-32768" and not an overflow
exception
+
2005-06-28 Manjula GHM <[EMAIL PROTECTED]>
*class.cs : Support suitable property to override
Modified: trunk/mcs/mbas/mb-tokenizer.cs
===================================================================
--- trunk/mcs/mbas/mb-tokenizer.cs 2005-06-30 07:53:32 UTC (rev 46756)
+++ trunk/mcs/mbas/mb-tokenizer.cs 2005-06-30 08:35:43 UTC (rev 46757)
@@ -76,6 +76,7 @@
StringBuilder number;
int putback_char = -1;
Object val;
+ long lon = 0;
//
// Details about the error encoutered by the tokenizer
@@ -540,7 +541,16 @@
switch (c){
case 'S': case 's':
t = Token.LITERAL_INTEGER; // SHORT ?
- val = ((IConvertible)val).ToInt16(null);
+
+ // hexadecimal literals - like &H8000S is
"-32768"
+ // and not an overflow exception
+ // Check for other literals ???
+
+ if(lon == 32768) {
+ val = (short) lon;
+ }
+ else
+ val =
((IConvertible)val).ToInt16(null);
break;
case 'I': case 'i':
t = Token.LITERAL_INTEGER;
@@ -614,7 +624,8 @@
} else
break;
}
- return System.Int64.Parse (hexNumber.ToString(),
NumberStyles.HexNumber);
+ lon = System.Int64.Parse (hexNumber.ToString(),
NumberStyles.HexNumber);
+ return lon;
}
long octal_digits ()
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches