Author: martin
Date: 2008-01-25 11:47:09 -0500 (Fri, 25 Jan 2008)
New Revision: 93925

Modified:
   branches/martin/debugger-terrania/debugger/ChangeLog
   
branches/martin/debugger-terrania/debugger/frontend/CSharpExpressionParser.jay
   branches/martin/debugger-terrania/debugger/frontend/CSharpTokenizer.cs
Log:
2008-01-25  Martin Baulig  <[EMAIL PROTECTED]>

        * frontend/CSharpTokenizer.cs
        (CSharpTokenizer.ReadGenericArity): New public property.
        (CSharpTokenizer.ReadDigit): If `ReadGenericArity' is true, only
        read an integer and stop on the first non-digit.  This is
        necessary to properly tokenize "Foo`1.Data".



Modified: branches/martin/debugger-terrania/debugger/ChangeLog
===================================================================
--- branches/martin/debugger-terrania/debugger/ChangeLog        2008-01-25 
16:17:53 UTC (rev 93924)
+++ branches/martin/debugger-terrania/debugger/ChangeLog        2008-01-25 
16:47:09 UTC (rev 93925)
@@ -1,3 +1,11 @@
+2008-01-25  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * frontend/CSharpTokenizer.cs
+       (CSharpTokenizer.ReadGenericArity): New public property.
+       (CSharpTokenizer.ReadDigit): If `ReadGenericArity' is true, only
+       read an integer and stop on the first non-digit.  This is
+       necessary to properly tokenize "Foo`1.Data".
+
 2008-01-23  Martin Baulig  <[EMAIL PROTECTED]>
 
        Added `$parent (expr)' and `$parent+N (expr)' syntax.

Modified: 
branches/martin/debugger-terrania/debugger/frontend/CSharpExpressionParser.jay
===================================================================
--- 
branches/martin/debugger-terrania/debugger/frontend/CSharpExpressionParser.jay  
    2008-01-25 16:17:53 UTC (rev 93924)
+++ 
branches/martin/debugger-terrania/debugger/frontend/CSharpExpressionParser.jay  
    2008-01-25 16:47:09 UTC (rev 93925)
@@ -298,10 +298,15 @@
          {
                $$ = (string) $1;
          }
-       | IDENTIFIER BACKTICK INT
+       | IDENTIFIER BACKTICK
          {
-               $$ = String.Format ("{0}`{1}", (string) $1, (int) $3);
+               lexer.ReadGenericArity = true;
          }
+         INT
+         {
+               lexer.ReadGenericArity = false;
+               $$ = String.Format ("{0}`{1}", (string) $1, (int) $4);
+         }
        ;
 
 variable_or_type_name_0

Modified: branches/martin/debugger-terrania/debugger/frontend/CSharpTokenizer.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/frontend/CSharpTokenizer.cs      
2008-01-25 16:17:53 UTC (rev 93924)
+++ branches/martin/debugger-terrania/debugger/frontend/CSharpTokenizer.cs      
2008-01-25 16:47:09 UTC (rev 93925)
@@ -45,8 +45,9 @@
                // Details about the error encoutered by the tokenizer
                //
                string error_details;
-               
 
+               public bool ReadGenericArity { get; set; }
+
                //
                // Class initializer
                // 
@@ -248,6 +249,26 @@
                        bool isfloat    = false;
                        bool isdouble   = false;
                        bool isdecimal  = false;
+
+                       string digit;
+
+                       if (ReadGenericArity) {
+                               while (Char.IsDigit((char)PeekChar())) {
+                                       sb.Append((char)GetChar());
+                                       ++col;
+                               }
+
+                               digit = sb.ToString ();
+
+                               try {
+                                       val = Int32.Parse(digit, 
NumberStyles.Number);
+                                       return Token.INT;
+                               } catch (Exception) {
+                                       error_details = String.Format("Can't 
parse int {0}", digit);
+                                       val = 0;
+                                       return Token.ERROR;
+                               }
+                       }
                        
                        if (ch == '0' && Char.ToUpper((char)PeekChar()) == 'X') 
{
                                const string hex = "0123456789ABCDEF";
@@ -333,7 +354,7 @@
                                }
                        }
                        
-                       string digit = sb.ToString();
+                       digit = sb.ToString();
                        //string stringValue = String.Concat(prefix.ToString(), 
digit, suffix.ToString());
                        if (isfloat) {
                                try {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to