digitalmars.D.learn - std.regex: bug or something special?
- Lubos Pintes (6/6) Feb 14 2013 Hi,
 - Dmitry Olshansky (14/20) Feb 14 2013 A bug. Especially considering the full source:
 - H. S. Teoh (7/15) Feb 14 2013 Looks like a bug. The last clause of the if-condition should check <=
 
Hi,
I am reading std.regex. I found the following code on line 671:
         else if('A' <= current && current <= 'Z')
             val = val * 16 + current - 'A' + 10;
Hex digits are parsed there. So unles this is something special, this is 
a bug. Because for example what 'J' would mean in this context?
 Feb 14 2013
14-Feb-2013 22:24, Lubos Pintes пишет:
 Hi,
 I am reading std.regex. I found the following code on line 671:
          else if('A' <= current && current <= 'Z')
              val = val * 16 + current - 'A' + 10;
 Hex digits are parsed there. So unles this is something special, this is
 a bug. Because for example what 'J' would mean in this context?
A bug. Especially considering the full source:
	if('0' <= current && current <= '9')
             val = val * 16 + current - '0';
         else if('a' <= current && current <= 'f')
             val = val * 16 + current -'a' + 10;
         else if('A' <= current && current <= 'Z')
             val = val * 16 + current - 'A' + 10;
I'd say file it or better yet submit a pull with a unittest that 
presently  does something fishy. For instance "\u00JJ" would parse and 
match m-hm 'J'-'A' * 16 + 'J' - 'A' where it shouldn't parse in the 
first place.
-- 
Dmitry Olshansky
 Feb 14 2013
On Thu, Feb 14, 2013 at 07:24:32PM +0100, Lubos Pintes wrote:
 Hi,
 I am reading std.regex. I found the following code on line 671:
         else if('A' <= current && current <= 'Z')
             val = val * 16 + current - 'A' + 10;
 
 Hex digits are parsed there. So unles this is something special,
 this is a bug. Because for example what 'J' would mean in this
 context?
Looks like a bug. The last clause of the if-condition should check <=
'F', not <= 'Z'.
Please file a bug at http://d.puremagic.com/issues .
T
-- 
GEEK = Gatherer of Extremely Enlightening Knowledge
 Feb 14 2013








 
 
 
 Dmitry Olshansky <dmitry.olsh gmail.com> 