Commit Graph

10 Commits

Author SHA1 Message Date
Andrew Johnson
a8e0de043c Support for 'single-quoted strings'
Also adds missing character flag VIC for 'r'.
The a5_spec_example test was copied from the JSON5 spec.
2020-08-09 00:33:07 -05:00
Andrew Johnson
549d6f67e3 YAJL support for JSON5 \xXX hex escapes in strings, with tests
Teach the lexer/parser to recognize and decode them in JSON5 mode.
Teach the encoder to use them in JSON5 mode.
Add another error message for bad hex digits.
Test cases to show they work, and that the bad-digit check fires.
2020-08-09 00:33:07 -05:00
Andrew Johnson
55f4e55383 Support for JSON5 character escapes in strings
Any character other than the digits 1-9 may be preceded by a
reverse solidus '\', and unless the combination has an explicitly
defined expansion the character is included without the solidus.
JSON5 adds \', \0 and \v to the set of defined escapes, and an
escaped newline is omitted from a string.

In the test case Perl uses \13 instead of \v in the output
but it is the correct character (13 octal = 11 decimal = '\v').
2020-08-09 00:33:07 -05:00
Andrew Johnson
e2256d0663 Accept unquoted identifiers as map keys
Adds another lexer entry point for lexing map keys only,
adjust parser to use this instead of the general lexer.
Also defines another lexer token for internal use only.
2020-08-09 00:33:07 -05:00
Andrew Johnson
97b8df6912 Added JSON5 support for parsing special numbers
NaN and both Infinities, with tests.
Special handling was added to yajl_test since different OSs don't
always generate the same output for special numbers (nan/NaN/...).
2020-08-09 00:33:07 -05:00
Andrew Johnson
98a358437f Add JSON5 support for hexadecimal integers
With tests for YAJL.

Note yajl_parse_integer still can't handle LLONG_MIN in base 10 or 16.
2020-08-09 00:33:07 -05:00
Andrew Johnson
00ac15cec5 Turning on JSON5 also enables comments
Includes the simple test case.
2020-08-09 00:33:07 -05:00
Andrew Johnson
456e774d85 JSON5: Modified lexer for some number support
If configured for JSON5 the lexer now allows a leading or trailing
decimal point on doubles, and an explicit leading + sign on integers
or double numbers.

Includes test cases.
2020-08-09 00:33:07 -05:00
Andrew Johnson
91c5b2fee2 Trailing commas now require a json5 parser
Modifies the yajl test case to add the -5 option
2020-08-09 00:33:06 -05:00
Ralph Lange
833648c977 Move all under modules/libcom 2018-06-19 11:25:46 +02:00