1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Partial implementation of JSON5 numeric literal extensions. Use a switch()

statement in the parser for better performance.

FossilOrigin-Name: 78404dc37024cad5fe7eacf78ea85b56f08b129a1b9a046c3e1b11275068a485
This commit is contained in:
drh
2023-04-26 17:30:28 +00:00
parent 5255102e04
commit f14b2e35fa
4 changed files with 117 additions and 52 deletions

View File

@ -301,18 +301,27 @@ for {set i 0} {$i<100} {incr i} {
# allowing them. The following tests verify that the problem is now
# fixed.
#
do_execsql_test json102-1401 { SELECT json_valid('{"x":01}') } 0
do_execsql_test json102-1402 { SELECT json_valid('{"x":-01}') } 0
do_execsql_test json102-1403 { SELECT json_valid('{"x":0}') } 1
do_execsql_test json102-1404 { SELECT json_valid('{"x":-0}') } 1
do_execsql_test json102-1405 { SELECT json_valid('{"x":0.1}') } 1
do_execsql_test json102-1406 { SELECT json_valid('{"x":-0.1}') } 1
do_execsql_test json102-1407 { SELECT json_valid('{"x":0.0000}') } 1
do_execsql_test json102-1408 { SELECT json_valid('{"x":-0.0000}') } 1
do_execsql_test json102-1409 { SELECT json_valid('{"x":01.5}') } 0
do_execsql_test json102-1410 { SELECT json_valid('{"x":-01.5}') } 0
do_execsql_test json102-1411 { SELECT json_valid('{"x":00}') } 0
do_execsql_test json102-1412 { SELECT json_valid('{"x":-00}') } 0
foreach {id j x0 x5} {
1401 {'{"x":01}'} 0 1
1402 {'{"x":-01}'} 0 1
1403 {'{"x":0}'} 1 1
1404 {'{"x":-0}'} 1 1
1405 {'{"x":0.1}'} 1 1
1406 {'{"x":-0.1}'} 1 1
1407 {'{"x":0.0000}'} 1 1
1408 {'{"x":-0.0000}'} 1 1
1409 {'{"x":01.5}'} 0 1
1410 {'{"x":-01.5}'} 0 1
1411 {'{"x":00}'} 0 1
1412 {'{"x":-00}'} 0 1
1413 {'{"x":+0}'} 0 1
1414 {'{"x":+5}'} 0 1
1415 {'{"x":+5.5}'} 0 1
} {
do_execsql_test json102-$id "
SELECT json_valid($j), json_valid5($j);
" [list $x0 $x5]
}
#------------------------------------------------------------------------
# 2017-04-10 ticket 6c9b5514077fed34551f98e64c09a10dc2fc8e16