if any tokenizing errors occur.
* ILTokenizer.cs:
* NumberHelper.cs: Use the new exception.
svn path=/trunk/mcs/; revision=29241
+2004-06-10 Jackson Harper <jackson@ximian.com>
+
+ * ILTokenizingExpcetion.cs: New exception thrown by the tokenizer
+ if any tokenizing errors occur.
+ * ILTokenizer.cs:
+ * NumberHelper.cs: Use the new exception.
+
2004-06-04 Jackson Harper <jackson@ximian.com>
* ILTokenizer.cs: Handle comments first, handle whitespace in hex
}\r
\r
if (!is_hex (ch))\r
- throw new Exception ("Invalid hex value. '" + (char) ch + "'."); // yeah proper error reporting would be great\r
+ throw new ILTokenizingException (reader.Location, ((char) ch).ToString ());\r
hx += (char) ch;\r
if (is_hex (reader.Peek ()))\r
hx += (char) reader.Read ();\r
else if (!Char.IsWhiteSpace ((char) reader.Peek ()) && reader.Peek () != ')')\r
- throw new Exception ("Invalid hex value. '" + (char) reader.Peek () + "'.");\r
+ throw new ILTokenizingException (reader.Location,\r
+ ((char) reader.Peek ()).ToString ());\r
res.token = Token.HEXBYTE;\r
res.val = Byte.Parse (hx, NumberStyles.HexNumber);\r
\r
--- /dev/null
+//
+// Mono.ILASM.ILTokenizingException
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// Copyright 2004 Novell, Inc (http://www.novell.com)
+//
+
+
+using System;
+
+namespace Mono.ILASM {
+
+ public class ILTokenizingException : Exception {
+
+ public readonly Location Location;
+ public readonly string Token;
+
+ public ILTokenizingException (Location location, string token)
+ {
+ Location = location;
+ Token = token;
+ }
+ }
+
+}
+
+
\r
if (is_e (ch)) {\r
if (is_real)\r
- throw new Exception ("Bad number format, multiples e's found.");\r
+ throw new ILTokenizingException (reader.Location, num_builder.ToString ());\r
\r
is_real = true;\r
}\r
reader.RestoreLocation ();\r
num = String.Empty;\r
Reset ();\r
- throw new ILSyntaxError ("Bad number format! '" + num_builder + "'");\r
+ throw new ILTokenizingException (reader.Location, num_builder.ToString ());\r
}\r
return num;\r
}\r
\r
ch = reader.Read ();\r
if (ch != '0')\r
- throw new Exception ("Bad hex number format, first char is not 0");\r
+ throw new ILTokenizingException (reader.Location, ((char) ch).ToString ());\r
\r
ch = reader.Read ();\r
\r
if (ch != 'x' && ch != 'X')\r
- throw new Exception ("Bad hex number format, second char is not x or X");\r
+ throw new ILTokenizingException (reader.Location, "0" + (char) ch);\r
\r
do {\r
ch = reader.Read ();\r
break;\r
\r
if (num_builder.Length == 32)\r
- throw new Exception ("Number too big.");\r
+ throw new ILTokenizingException (reader.Location, num_builder.ToString ());\r
\r
} while (ch != -1);\r
\r
reader.RestoreLocation ();\r
num = String.Empty;\r
Reset ();\r
- throw new ILSyntaxError ("Bad hex number format! '" + tnum + "'");\r
+ throw new ILTokenizingException (reader.Location, tnum);\r
}\r
return num;\r
}\r