Skip to content

Commit 825d16c

Browse files
authored
Merge pull request #127 from markellus/develop
Json-Tokenizer doesn't work with negative numbers
2 parents f1b7ece + 8b2d1e6 commit 825d16c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/jx9_json.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ static sxi32 VmJsonTokenize(SyStream *pStream, SyToken *pToken, void *pUserData,
336336
pToken->nType = JSON_TK_STR;
337337
pStream->zText++; /* Jump the closing double quotes */
338338
}
339-
}else if( pStream->zText[0] < 0xc0 && SyisDigit(pStream->zText[0]) ){
339+
}else if( (pStream->zText[0] < 0xc0 && SyisDigit(pStream->zText[0]))
340+
|| pStream->zText[0] == '-' || pStream->zText[0] == '+' ){
340341
/* Number */
341342
pStream->zText++;
342343
pToken->nType = JSON_TK_NUM;

unqlite.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25476,7 +25476,8 @@ static sxi32 VmJsonTokenize(SyStream *pStream, SyToken *pToken, void *pUserData,
2547625476
pToken->nType = JSON_TK_STR;
2547725477
pStream->zText++; /* Jump the closing double quotes */
2547825478
}
25479-
}else if( pStream->zText[0] < 0xc0 && SyisDigit(pStream->zText[0]) ){
25479+
}else if( (pStream->zText[0] < 0xc0 && SyisDigit(pStream->zText[0]))
25480+
|| pStream->zText[0] == '-' || pStream->zText[0] == '+' ){
2548025481
/* Number */
2548125482
pStream->zText++;
2548225483
pToken->nType = JSON_TK_NUM;

0 commit comments

Comments
 (0)