[Issue 5955] core.demangle fail to parse NaN and Infinity.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 8 03:19:38 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5955


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from kennytm at gmail.com 2011-05-08 03:15:42 PDT ---
Patch:


@@ -354,6 +354,14 @@ private struct Demangle
             tbuf[tlen++] = '-';
             next();
         }
+        if( 'I' == tok() ) // INF
+        {
+            match( "INF" );
+            bool isNegative = tlen == 1;
+            debug(info) printf( "got (%sINF)\n", isNegative ? "N" : "" );
+            put( isNegative ? "-real.infinity" : "real.infinity" );
+            return;
+        }
         tbuf[tlen++] = '0';
         tbuf[tlen++] = 'X';
         if( !isHexDigit( tok() ) )
@@ -362,6 +370,19 @@ private struct Demangle
         tbuf[tlen++] = '.';
         next();

+        if( 'N' == tok() ) // NAN
+        {
+            if( tbuf[0] == '-' && tbuf[3] == 'A' )
+            {
+                next();
+                debug(info) printf( "got (NAN)\n" );
+                put( "real.nan" );
+                return;
+            }
+            else
+                error( "Unexpected 'N'" );
+        }
+
         while( isHexDigit( tok() ) )
         {
             tbuf[tlen++] = tok();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list