diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-07-22 08:07:19 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-07-22 08:07:19 -0700 |
commit | e5a6c31be5da033320f6414fab0b31ef88f3260c (patch) | |
tree | a2f55843aab915431f18ee0946b0eae84a9dbfcd /txr.1 | |
parent | 74d7277b99dfe15797464f41adc5204c728eca6b (diff) | |
download | txr-e5a6c31be5da033320f6414fab0b31ef88f3260c.tar.gz txr-e5a6c31be5da033320f6414fab0b31ef88f3260c.tar.bz2 txr-e5a6c31be5da033320f6414fab0b31ef88f3260c.zip |
json: new *read-json-int* variable.
* parser.h (struct parser): New member, read_json_int.
* parser.c (read_json_int_s): New symbol variable
for *read-json-int* symbol.
(parser_common_init): Look up value of *read-json-int*
and store in read_json_int struct member.
(parse_init): Initialize read_json_int_s with interned
symbol and also register the dynamic variable.
* parser.l (grammar): Extend the {JNUM} rule to check
the read_json_int flag and produce an integer value if
the lexeme does not contain a decimal point, e or E.
* tests/010/json.tl: New tests.
* txr.1: Documented.
* lex.yy.c.shipped: Regenerated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -84788,6 +84788,32 @@ tolerance in the area of JSON parsing. --> #H(() (3.0 4.0)) .brev +.coNP Variable @ *read-json-int* +.desc +This dynamic variable, initialized to a value of +.codn nil , +controls whether the parser reads some JSON numbers as integer objects. + +If the value of the variable is true, then whenever a JSON number is +scanned which does not contain a +.code . +(decimal point) character or the letters +.code e +or +.code E +indicating an exponent field, it is converted to an integer object +rather than a floating-point value. It is unspecified whether the number +is converted to integer or floating-point if the exponent +.code e +or +.code E +is present, with a positive exponent value. + +If this variable is +.codn nil , +then JSON numbers are all converted to floating point. + + .SH* FOREIGN FUNCTION INTERFACE On platforms where it is supported, \*(TX provides a feature called the |