reinforce readToken function and add simple tests (#1012)

This commit is contained in:
dota17
2019-09-17 02:25:22 +08:00
committed by Jordan Bayles
parent c5cb313ca0
commit 2cb9a5803e
2 changed files with 15 additions and 4 deletions

View File

@@ -1227,6 +1227,14 @@ bool OurReader::readToken(Token& token) {
ok = features_.allowSpecialFloats_ && match("nfinity", 7);
}
break;
case '+':
if (readNumber(true)) {
token.type_ = tokenNumber;
} else {
token.type_ = tokenPosInf;
ok = features_.allowSpecialFloats_ && match("nfinity", 7);
}
break;
case 't':
token.type_ = tokenTrue;
ok = match("rue", 3);