ruby/ext/json/parser
Luke T. Shumaker 74d459fd52 [ruby/json] Adjust to the CVTUTF code being gone
I, Luke T. Shumaker, am the sole author of the added code.

I did not reference CVTUTF when writing it.  I did reference the
Unicode standard (15.0.0), the Wikipedia article on UTF-8, and the
Wikipedia article on UTF-16.  When I saw some tests fail, I did
reference the old deleted code (but a JSON-specific part, inherently
not as based on CVTUTF) to determine that script_safe should also
escape U+2028 and U+2029.

I targeted simplicity and clarity when writing the code--it can likely
be optimized.  In my mind, the obvious next optimization is to have it
combine contiguous non-escaped characters into just one call to
fbuffer_append(), instead of calling fbuffer_append() for each
character.

Regarding the use of the "modern" types `uint32_t`, `uint16_t`, and
`bool`:
 - ruby.h is guaranteed to give us uint32_t and uint16_t.
 - Since Ruby 3.0.0, ruby.h is guaranteed to give us bool... but we
   support down to Ruby 2.3.  But, ruby.h is guaranteed to give us
   HAVE_STDBOOL_H for the C99 stdbool.h; so use that to include
   stdbool.h if we can, and if not then fall back to a copy of the
   same bool definition that Ruby 3.0.5 uses with C89.

c96351f874
2024-10-08 14:10:05 +09:00
..
depend ruby tool/update-deps --fix 2024-04-27 21:55:28 +09:00
extconf.rb [flori/json] Deduplicate strings inside json_string_unescape 2021-05-17 19:51:51 +09:00
parser.c [ruby/json] Adjust to the CVTUTF code being gone 2024-10-08 14:10:05 +09:00
parser.h [ruby/json] Adjust to the CVTUTF code being gone 2024-10-08 14:10:05 +09:00
parser.rl [ruby/json] Adjust to the CVTUTF code being gone 2024-10-08 14:10:05 +09:00
prereq.mk ext/json/parser/prereq.mk: fix warnings for code generated by ragel 2021-05-18 23:26:03 +09:00