@@ -1107,7 +1107,7 @@ protected JsonToken _startFalseToken() throws IOException
1107
1107
&& (getByteFromBuffer (ptr ++) == 's' )
1108
1108
&& (getByteFromBuffer (ptr ++) == 'e' )) {
1109
1109
int ch = getByteFromBuffer (ptr ) & 0xFF ;
1110
- if (ch < INT_0 || (ch == INT_RBRACKET ) || ( ch == INT_RCURLY )) { // expected/allowed chars
1110
+ if (ch < INT_0 || (ch | 0x20 ) == INT_RCURLY ) { // < '0' || ~ '}]' expected/allowed chars
1111
1111
_inputPtr = ptr ;
1112
1112
return _valueComplete (JsonToken .VALUE_FALSE );
1113
1113
}
@@ -1125,7 +1125,7 @@ protected JsonToken _startTrueToken() throws IOException
1125
1125
&& (getByteFromBuffer (ptr ++) == 'u' )
1126
1126
&& (getByteFromBuffer (ptr ++) == 'e' )) {
1127
1127
int ch = getByteFromBuffer (ptr ) & 0xFF ;
1128
- if (ch < INT_0 || (ch == INT_RBRACKET ) || ( ch == INT_RCURLY )) { // expected/allowed chars
1128
+ if (ch < INT_0 || (ch | 0x20 ) == INT_RCURLY ) { // < '0' || ~ '}]' expected/allowed chars
1129
1129
_inputPtr = ptr ;
1130
1130
return _valueComplete (JsonToken .VALUE_TRUE );
1131
1131
}
@@ -1143,7 +1143,7 @@ protected JsonToken _startNullToken() throws IOException
1143
1143
&& (getByteFromBuffer (ptr ++) == 'l' )
1144
1144
&& (getByteFromBuffer (ptr ++) == 'l' )) {
1145
1145
int ch = getByteFromBuffer (ptr ) & 0xFF ;
1146
- if (ch < INT_0 || (ch == INT_RBRACKET ) || ( ch == INT_RCURLY )) { // expected/allowed chars
1146
+ if (ch < INT_0 || (ch | 0x20 ) == INT_RCURLY ) { // < '0' || ~ '}]' expected/allowed chars
1147
1147
_inputPtr = ptr ;
1148
1148
return _valueComplete (JsonToken .VALUE_NULL );
1149
1149
}
@@ -1165,7 +1165,7 @@ protected JsonToken _finishKeywordToken(String expToken, int matched,
1165
1165
}
1166
1166
int ch = getByteFromBuffer (_inputPtr );
1167
1167
if (matched == end ) { // need to verify trailing separator
1168
- if (ch < INT_0 || (ch == INT_RBRACKET ) || ( ch == INT_RCURLY )) { // expected/allowed chars
1168
+ if (ch < INT_0 || (ch | 0x20 ) == INT_RCURLY ) { // < '0' || ~ '}]' expected/allowed chars
1169
1169
return _valueComplete (result );
1170
1170
}
1171
1171
break ;
@@ -1205,7 +1205,7 @@ protected JsonToken _finishNonStdToken(int type, int matched) throws IOException
1205
1205
}
1206
1206
int ch = getByteFromBuffer (_inputPtr );
1207
1207
if (matched == end ) { // need to verify trailing separator
1208
- if (ch < INT_0 || (ch == INT_RBRACKET ) || ( ch == INT_RCURLY )) { // expected/allowed chars
1208
+ if (ch < INT_0 || (ch | 0x20 ) == INT_RCURLY ) { // < '0' || ~ '}]' expected/allowed chars
1209
1209
return _valueNonStdNumberComplete (type );
1210
1210
}
1211
1211
break ;
@@ -1306,7 +1306,7 @@ protected JsonToken _startPositiveNumber(int ch) throws IOException
1306
1306
break ;
1307
1307
}
1308
1308
if (ch > INT_9 ) {
1309
- if (ch == INT_e || ch == INT_E ) {
1309
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1310
1310
_intLength = outPtr ;
1311
1311
++_inputPtr ;
1312
1312
return _startFloat (outBuf , outPtr , ch );
@@ -1373,7 +1373,7 @@ protected JsonToken _startNegativeNumber() throws IOException
1373
1373
break ;
1374
1374
}
1375
1375
if (ch > INT_9 ) {
1376
- if (ch == INT_e || ch == INT_E ) {
1376
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1377
1377
_intLength = outPtr -1 ;
1378
1378
++_inputPtr ;
1379
1379
return _startFloat (outBuf , outPtr , ch );
@@ -1445,7 +1445,7 @@ protected JsonToken _startPositiveNumber() throws IOException
1445
1445
break ;
1446
1446
}
1447
1447
if (ch > INT_9 ) {
1448
- if (ch == INT_e || ch == INT_E ) {
1448
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1449
1449
_intLength = outPtr -1 ;
1450
1450
++_inputPtr ;
1451
1451
return _startFloat (outBuf , outPtr , ch );
@@ -1492,7 +1492,7 @@ protected JsonToken _startNumberLeadingZero() throws IOException
1492
1492
return _startFloat (outBuf , 1 , ch );
1493
1493
}
1494
1494
} else if (ch > INT_9 ) {
1495
- if (ch == INT_e || ch == INT_E ) {
1495
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1496
1496
_inputPtr = ptr ;
1497
1497
_intLength = 1 ;
1498
1498
char [] outBuf = _textBuffer .emptyAndGetCurrentSegment ();
@@ -1502,7 +1502,7 @@ protected JsonToken _startNumberLeadingZero() throws IOException
1502
1502
// Ok; unfortunately we have closing bracket/curly that are valid so need
1503
1503
// (colon not possible since this is within value, not after key)
1504
1504
//
1505
- if ((ch != INT_RBRACKET ) && ( ch != INT_RCURLY )) {
1505
+ if ((ch | 0x20 ) != INT_RCURLY ) { // ~ '}]'
1506
1506
_reportUnexpectedNumberChar (ch ,
1507
1507
"expected digit (0-9), decimal point (.) or exponent indicator (e/E) to follow '0'" );
1508
1508
}
@@ -1590,7 +1590,7 @@ protected JsonToken _finishNumberLeadingZeroes() throws IOException
1590
1590
return _startFloat (outBuf , 1 , ch );
1591
1591
}
1592
1592
} else if (ch > INT_9 ) {
1593
- if (ch == INT_e || ch == INT_E ) {
1593
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1594
1594
char [] outBuf = _textBuffer .emptyAndGetCurrentSegment ();
1595
1595
outBuf [0 ] = '0' ;
1596
1596
_intLength = 1 ;
@@ -1599,7 +1599,7 @@ protected JsonToken _finishNumberLeadingZeroes() throws IOException
1599
1599
// Ok; unfortunately we have closing bracket/curly that are valid so need
1600
1600
// (colon not possible since this is within value, not after key)
1601
1601
//
1602
- if ((ch != INT_RBRACKET ) && ( ch != INT_RCURLY )) {
1602
+ if ((ch | 0x20 ) != INT_RCURLY ) { // ~ '}]'
1603
1603
_reportUnexpectedNumberChar (ch ,
1604
1604
"expected digit (0-9), decimal point (.) or exponent indicator (e/E) to follow '0'" );
1605
1605
}
@@ -1649,7 +1649,7 @@ protected JsonToken _finishNumberLeadingPosNegZeroes(final boolean negative) thr
1649
1649
return _startFloat (outBuf , 2 , ch );
1650
1650
}
1651
1651
} else if (ch > INT_9 ) {
1652
- if (ch == INT_e || ch == INT_E ) {
1652
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1653
1653
char [] outBuf = _textBuffer .emptyAndGetCurrentSegment ();
1654
1654
outBuf [0 ] = negative ? '-' : '+' ;
1655
1655
outBuf [1 ] = '0' ;
@@ -1659,7 +1659,7 @@ protected JsonToken _finishNumberLeadingPosNegZeroes(final boolean negative) thr
1659
1659
// Ok; unfortunately we have closing bracket/curly that are valid so need
1660
1660
// (colon not possible since this is within value, not after key)
1661
1661
//
1662
- if ((ch != INT_RBRACKET ) && ( ch != INT_RCURLY )) {
1662
+ if ((ch | 0x20 ) != INT_RCURLY ) { // ~ '}]'
1663
1663
_reportUnexpectedNumberChar (ch ,
1664
1664
"expected digit (0-9), decimal point (.) or exponent indicator (e/E) to follow '0'" );
1665
1665
}
@@ -1703,7 +1703,7 @@ protected JsonToken _finishNumberIntegralPart(char[] outBuf, int outPtr) throws
1703
1703
break ;
1704
1704
}
1705
1705
if (ch > INT_9 ) {
1706
- if (ch == INT_e || ch == INT_E ) {
1706
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE'
1707
1707
_intLength = outPtr +negMod ;
1708
1708
++_inputPtr ;
1709
1709
return _startFloat (outBuf , outPtr , ch );
@@ -1758,7 +1758,7 @@ protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws IOExce
1758
1758
}
1759
1759
_fractLength = fractLen ;
1760
1760
int expLen = 0 ;
1761
- if (ch == INT_e || ch == INT_E ) { // exponent?
1761
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE' exponent?
1762
1762
if (outPtr >= outBuf .length ) {
1763
1763
outBuf = _textBuffer .expandCurrentSegment ();
1764
1764
}
@@ -1833,7 +1833,7 @@ protected JsonToken _finishFloatFraction() throws IOException
1833
1833
return JsonToken .NOT_AVAILABLE ;
1834
1834
}
1835
1835
ch = getNextSignedByteFromBuffer ();
1836
- } else if (ch == 'f' || ch == 'd' || ch == 'F' || ch == 'D' ) {
1836
+ } else if (( ch | 0x22 ) == 'f' ) { // ~ fFdD
1837
1837
_reportUnexpectedNumberChar (ch , "JSON does not support parsing numbers that have 'f' or 'd' suffixes" );
1838
1838
} else if (ch == INT_PERIOD ) {
1839
1839
_reportUnexpectedNumberChar (ch , "Cannot parse number with more than one decimal point" );
@@ -1853,7 +1853,7 @@ protected JsonToken _finishFloatFraction() throws IOException
1853
1853
_textBuffer .setCurrentLength (outPtr );
1854
1854
1855
1855
// Ok: end of floating point number or exponent?
1856
- if (ch == INT_e || ch == INT_E ) { // exponent?
1856
+ if (( ch | 0x20 ) == INT_e ) { // ~ 'eE' exponent?
1857
1857
_textBuffer .append ((char ) ch );
1858
1858
_expLength = 0 ;
1859
1859
if (_inputPtr >= _inputEnd ) {
0 commit comments