|
@@ -152,7 +152,7 @@ class JsonParser {
|
|
function parseString() {
|
|
function parseString() {
|
|
var start = pos;
|
|
var start = pos;
|
|
var buf:StringBuf = null;
|
|
var buf:StringBuf = null;
|
|
- #if (target.unicode)
|
|
|
|
|
|
+ #if target.unicode
|
|
var prev = -1;
|
|
var prev = -1;
|
|
inline function cancelSurrogate() {
|
|
inline function cancelSurrogate() {
|
|
// invalid high surrogate (not followed by low surrogate)
|
|
// invalid high surrogate (not followed by low surrogate)
|
|
@@ -170,7 +170,7 @@ class JsonParser {
|
|
}
|
|
}
|
|
buf.addSub(str,start, pos - start - 1);
|
|
buf.addSub(str,start, pos - start - 1);
|
|
c = nextChar();
|
|
c = nextChar();
|
|
- #if (target.unicode)
|
|
|
|
|
|
+ #if target.unicode
|
|
if( c != "u".code && prev != -1 ) cancelSurrogate();
|
|
if( c != "u".code && prev != -1 ) cancelSurrogate();
|
|
#end
|
|
#end
|
|
switch( c ) {
|
|
switch( c ) {
|
|
@@ -183,7 +183,7 @@ class JsonParser {
|
|
case 'u'.code:
|
|
case 'u'.code:
|
|
var uc:Int = Std.parseInt("0x" + str.substr(pos, 4));
|
|
var uc:Int = Std.parseInt("0x" + str.substr(pos, 4));
|
|
pos += 4;
|
|
pos += 4;
|
|
- #if !(target.unicode)
|
|
|
|
|
|
+ #if !target.unicode
|
|
if( uc <= 0x7F )
|
|
if( uc <= 0x7F )
|
|
buf.addChar(uc);
|
|
buf.addChar(uc);
|
|
else if( uc <= 0x7FF ) {
|
|
else if( uc <= 0x7FF ) {
|
|
@@ -230,7 +230,7 @@ class JsonParser {
|
|
else if( StringTools.isEof(c) )
|
|
else if( StringTools.isEof(c) )
|
|
throw "Unclosed string";
|
|
throw "Unclosed string";
|
|
}
|
|
}
|
|
- #if (target.unicode)
|
|
|
|
|
|
+ #if target.unicode
|
|
if( prev != -1 )
|
|
if( prev != -1 )
|
|
cancelSurrogate();
|
|
cancelSurrogate();
|
|
#end
|
|
#end
|