]> granicus.if.org Git - re2c/commitdiff
- Little pedantiv oversight
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sun, 1 Jan 2006 03:05:01 +0000 (03:05 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sun, 1 Jan 2006 03:05:01 +0000 (03:05 +0000)
actions.cc

index 74afc42326c953400c356468e7df9f0ab1da7e62..22c8b994053e6440eacd46d593e6e723e41df62e 100644 (file)
@@ -569,21 +569,25 @@ uint Scanner::unescape(SubStr &s) const
                                      || !(p4 = strchr(hex, tolower(s.str[3]))))
                        {
                                fatal("Illegal hexadecimal character code");
+                               return ~0;
                        }
-                       s.len -= 4;
-                       s.str += 4;
-                       
-                       uint v = (uint)((p1 - hex) << 12) 
-                              + (uint)((p2 - hex) <<  8)
-                              + (uint)((p3 - hex) <<  4)
-                              + (uint)((p4 - hex));
-
-                       if (v >= nRealChars)
+                       else
                        {
-                               fatal("Illegal hexadecimal character code");
+                               s.len -= 4;
+                               s.str += 4;
+                               
+                               uint v = (uint)((p1 - hex) << 12) 
+                                      + (uint)((p2 - hex) <<  8)
+                                      + (uint)((p3 - hex) <<  4)
+                                      + (uint)((p4 - hex));
+       
+                               if (v >= nRealChars)
+                               {
+                                       fatal("Illegal hexadecimal character code");
+                               }
+       
+                               return v;
                        }
-
-                       return v;
                }
 
                case '0':
@@ -603,13 +607,17 @@ uint Scanner::unescape(SubStr &s) const
                                      || !(p2 = strchr(oct, s.str[1])))
                        {
                                fatal("Illegal octal character code");
+                               return ~0;
+                       }
+                       else
+                       {
+                               s.len -= 2;
+                               s.str += 2;
+                               
+                               uint v = (uint)((p0 - oct) << 6) + (uint)((p1 - oct) << 3) + (uint)(p2 - oct);
+       
+                               return v;
                        }
-                       s.len -= 2;
-                       s.str += 2;
-                       
-                       uint v = (uint)((p0 - oct) << 6) + (uint)((p1 - oct) << 3) + (uint)(p2 - oct);
-
-                       return v;
                }
 
                default: