JSON5 in dbStatic: Lexer support for NaN and Infinity
The JSON5 spec requires exact capitalization of these strings. Other numeric parsers such as strtod() are usually more lenient.
This commit is contained in:
@@ -33,10 +33,11 @@ exp ([eE]{sign}[0-9]+)
|
||||
jsonnum ({int}{frac}?{exp}?)
|
||||
intexp ({int}"."{exp}?)
|
||||
fracexp ({sign}{frac}{exp}?)
|
||||
specialnum ("NaN"|{sign}"Infinity")
|
||||
|
||||
zerox ("0x"|"0X")
|
||||
hexint ({sign}{zerox}{hexdigit}+)
|
||||
number ({jsonnum}|{intexp}|{fracexp}|{hexint})
|
||||
number ({jsonnum}|{intexp}|{fracexp}|{specialnum}|{hexint})
|
||||
|
||||
%{
|
||||
#undef YY_INPUT
|
||||
|
||||
@@ -73,4 +73,12 @@ record(x, "t1") {
|
||||
field(F64, -.123e4)
|
||||
field(F32, -123.e4)
|
||||
field(F64, -123.e4)
|
||||
field(F32, Infinity)
|
||||
field(F64, Infinity)
|
||||
field(F32, +Infinity)
|
||||
field(F64, +Infinity)
|
||||
field(F32, -Infinity)
|
||||
field(F64, -Infinity)
|
||||
field(F32, Nan)
|
||||
field(F64, Nan)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user