Differences From Artifact [c3668fbf8e]:
- File src/OFString+JSONValue.m — part of check-in [813c00ccf0] at 2013-01-09 22:24:47 on branch trunk — Update copyright. (user: js, size: 12790) [annotate] [blame] [check-ins using]
To Artifact [534d095364]:
- File
src/OFString+JSONValue.m
— part of check-in
[f59977a0aa]
at
2013-01-28 21:12:57
on branch trunk
— JSON5: Update to new version of the spec.
This adds support for Infinity and leading + signs. (user: js, size: 13019) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * file. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <assert.h> #import "OFString+JSONValue.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFNumber.h" | > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * file. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <math.h> #include <assert.h> #import "OFString+JSONValue.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFNumber.h" |
| ︙ | ︙ | |||
558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
@try {
if (hasDecimal)
number = [OFNumber numberWithDouble:
[string doubleValue]];
else if (isHex)
number = [OFNumber numberWithIntMax:
[string hexadecimalValue]];
else
number = [OFNumber numberWithIntMax:
[string decimalValue]];
} @finally {
[string release];
}
| > > > > | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
@try {
if (hasDecimal)
number = [OFNumber numberWithDouble:
[string doubleValue]];
else if (isHex)
number = [OFNumber numberWithIntMax:
[string hexadecimalValue]];
else if ([string isEqual: @"Infinity"])
number = [OFNumber numberWithDouble: INFINITY];
else if ([string isEqual: @"-Infinity"])
number = [OFNumber numberWithDouble: -INFINITY];
else
number = [OFNumber numberWithIntMax:
[string decimalValue]];
} @finally {
[string release];
}
|
| ︙ | ︙ | |||
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '-': case '.': return parseNumber(pointer, stop, line); default: return nil; } } @implementation OFString (JSONValue) | > > | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '+': case '-': case '.': case 'I': return parseNumber(pointer, stop, line); default: return nil; } } @implementation OFString (JSONValue) |
| ︙ | ︙ |